Python Flashcards
how is string presented
it is the text, and always it between quotation marks
how are integers presented
they are the numbers, without quotation marks
what is the print function
it outputs information
mathematical operations
add: 2+2
subtract: 2-2
multiply: 2*2
divide: 2/2
what separates integers and strings
COMMAS
what does /n do
it separates the code
variable names
cant have spaces, and cant start with #, can have capital letters, and _
to input info:
you have to write a variable= input (“write your name: “)
use the plus signs
to combine string and variable or variable with variable
convert input to integer
var1= int(input(“enter a number”)
var2= int(input(“enter a number”)
print(var1+var2)
to measure length of a string:
name= “thereza”
length=len(name)
print(length)
why do we use # in python
to add comments
python operators
> <
!=
=
<=
equal to
greater than
less than
not equal to
greater then or equal to
less then or equal to
if statements
if, elif, else