Flashcards : Python Basics and Math Functions — 36 cartes

Toutes les cartes

1Question

What does the print() function display in Python output?

Réponse

Text, numbers, and evaluated expressions.

2Question

Which quote styles can Python strings use?

Réponse

Single, double, or triple quotes.

3Question

What can triple-quoted strings do that single or double quotes cannot?

Réponse

Span multiple lines.

4Question

What does the escape sequence \n do inside a string?

Réponse

Inserts a line break.

5Question

What is the result of the expression "python"*4?

Réponse

The string repeated four times.

6Question

What does the built-in function abs() return?

Réponse

The absolute value of a number.

7Question

What does pow(a,b) calculate?

Réponse

The value of a raised to the power of b.

8Question

What does round(number,digits) do when digits is omitted?

Réponse

Rounds the number to the nearest integer.

9Question

What does round(number,digits) do when digits is specified?

Réponse

Rounds the number to the given decimal places.

10Question

What does ceil() return for a number?

Réponse

The smallest integer greater than or equal to the number.

11Question

What does floor() return for a number?

Réponse

The largest integer less than or equal to the number.

12Question

What does the factorial function return for an integer n?

Réponse

The product of all positive integers from 1 to n.

13Question

What is the value of 5! (factorial of 5)?

Réponse

120

14Question

What does 'import math' do in Python?

Réponse

It loads the math module for use with the math. prefix.

15Question

How does 'from math import factorial, pi, log2' affect name usage?

Réponse

It allows using factorial, pi, and log2 without the math. prefix.

16Question

What does 'import math as M' do?

Réponse

It assigns the alias M to the math module.

17Question

How do you call square root using the alias M after 'import math as M'?

Réponse

By calling M.sqrt(25).

18Question

What does 'from math import sqrt as jazr' do?

Réponse

It imports sqrt under the local alias jazr.

19Question

How do you compute the square root of 25 using the alias jazr?

Réponse

By calling jazr(25), which returns 5.

20Question

How does a compiler process code compared to an interpreter?

Réponse

A compiler processes the whole program before execution, an interpreter processes line by line.

21Question

Which commands run Python files in Visual Studio Code?

Réponse

Run Python File and Run Without Debugging (Ctrl+F5) run Python files.

22Question

How can you open the integrated terminal in Visual Studio Code?

Réponse

Through View → Terminal or with Ctrl+ backtick.

23Question

How do you launch a Python file from the integrated terminal?

Réponse

By typing python filename or py filename.

24Question

What is a Python library?

Réponse

A collection of ready-made code providing reusable functions or tools for a purpose.

25Question

Which Python library is used for data manipulation?

Réponse

Pandas is used for data manipulation.

26Question

Which Python library is used for numerical calculations?

Réponse

NumPy is used for numerical calculations.

27Question

Which Python library is used for data visualization?

Réponse

Matplotlib is used for data visualization.

28Question

Which Python library is used for machine learning?

Réponse

Scikit-learn is used for machine learning.

29Question

Which Python library is used for web development?

Réponse

Django is used for web development.

30Question

Name a Python library associated with deep learning.

Réponse

Keras is associated with deep learning.

31Question

Name two other Python libraries linked to deep learning besides Keras.

Réponse

TensorFlow and PyTorch are linked to deep learning.

32Question

How do you calculate the perimeter of a square with side length 5?

Réponse

Multiply 4 by 5 to get 20 units.

33Question

What formula calculates the area of a square with side length 5?

Réponse

Square the side length: 5 squared equals 25 square units.

34Question

How is the circumference of a circle with radius 5 calculated?

Réponse

Use 2π times 5 to find the circumference.

35Question

What formula calculates the area of a circle with radius 5?

Réponse

Multiply π by 5 squared to get the area.

36Question

How does the course demonstrate printing a patterned shape with asterisks?

Réponse

By placing asterisks and line breaks inside strings passed to print().

Teste-toi avec le QCM

Teste tes connaissances avec un QCM de 13 questions sur Python Basics and Math Functions.

1. What does Python display when it executes `print(2+5)`?

2. Which type of Python string can contain line breaks directly within its delimiters?

Faire le QCM →

Consultez la fiche

Révisez le cours complet dans la fiche de révision de Python Basics and Math Functions.

Voir la fiche →

Cours similaires

Crée tes propres flashcards

Importe ton cours et l'IA génère des flashcards en 30 secondes.

Générateur de flashcards