Ask user data as “variable”
variable = input()
Convert to string
Str()
Convert to integer
int()
Convert to float
float()
How to combine “result is” and result in print
print(f”result is {result}”
How to calculate x square
x**2
How to print without line end
print(“”, end=” “)
Shorter for:
sum = sum + x
sum += x
Operator equal
==
Operator not equal
!=
Data type True/False
bool
How to calculate square root of x
sqrt(x)
How to end an if line
:
Check if “number” is odd
if number %2 == 0:
Three possibilities If expression
if
elif
else
X ist nicht kleiner als 1
if not x < 1
Nested if condition
if:
If:
How to create a loop
while:
How to check length of a string?
len()
Adress first letter of “word”
word[0]
last character of “word”
word[len(word)-1]
search for X in “word”
“X” in word
locate a substring in string
string.find(substring)
jump to start of loop
continue