Operators Flashcards
What is equal to in python?
==
What is not equal to in python?
!=
What is greater than in python?
>
What is less than in python?
What is less than or equal to?
<=
What is greater than or equal to in python?
> =
How do you assign a variable in python?
=
How do you do constant in python?
MY_CONSTANT
i.e. BIRTH_YEAR = 2003
How do you do variables in python?
my_variable
i.e.
not_guessed = True
What is user input in python?
INPUT
What is output in python?
OUTPUT
How do you convert to another data type in python?
str ()
int ()
float()
What is IF in python?
if answer == correct:
print (“Correct!”)
What is IF,ELSE in python?
if answer == correct:
print(“Correct!”)
else:
print(“Incorrect!”)
What is IF, ELIF, ELSE in python?
if answer == 5: print("Correct!") elif answer == 6: print ("Almost") else: print("Incorrect!")
What is For loop in python?
for….in…..to…..
block of statements
end for
What is while loop in python?
while not_guessed:
number = input ()
How do you do subroutine in python?
def add (a,b): answer = a+b print (answer)
How do you return in python?
return answer
How do you call a subroutine in python?
add(3, 4)
How do you do assignment in python?
identifier = [item1, item2]
How do you access an item on python?
animals[0]
How do you update an item on python?
identifier[index] = “item”
How do you do length of list on python?
len(identifier)