★ Must-know
The print() function displays text, numbers, and evaluated expressions in the program output.
Python strings can use single quotes, double quotes, or triple quotes, and triple-quoted strings can span multiple lines.
Further detail
The escape sequence \n inserts a line break inside a string.
The expression "python"*4 repeats the string four times.
abs() returns the absolute value of a number, such as 4 for abs(-4).pow(a,b) calculates the value of , such as .round(number,digits) rounds a number to the requested number of decimal places, while omitting digits rounds to the nearest integer.ceil() returns the smallest integer greater than or equal to a number, whereas floor() returns the largest integer less than or equal to it.★ Must-know
import math loads the math module, whose functions and constants are accessed with the math. prefix.
from math import factorial, pi, log2 imports selected names so they can be used without the math. prefix.
Further detail
import math as M assigns the alias M to the math module, so M.sqrt(25) calls the square-root function through that alias.
from math import sqrt as jazr imports sqrt under the local alias jazr, so jazr(25) returns 5.
★ Must-know
📌 A compiler processes code as a program before execution, whereas an interpreter processes and executes code line by line.
Run Python File or with Run Without Debugging using Ctrl+F5.Further detail
Ctrl+ backtick, and a Python file can be launched with python filename or py filename.★ Must-know
Further detail
★ Must-know
📐 Formula — For a square with side length , the perimeter is calculated as units and the area as square units.
📐 Formula — For a circle with radius , the circumference is calculated as and the area as .
Further detail
print().Teste tes connaissances sur Python Basics and Math Functions avec 13 questions à choix multiples et corrections détaillées.
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?
Mémorisez les concepts clés de Python Basics and Math Functions avec 36 flashcards interactives.
What does the print() function display in Python output?
Text, numbers, and evaluated expressions.
Which quote styles can Python strings use?
Single, double, or triple quotes.
What can triple-quoted strings do that single or double quotes cannot?
Span multiple lines.
Importe ton cours et l'IA génère fiches, QCM et flashcards en 30 secondes.
Générateur de fiches