Python Functions Flashcards
1
Q
What is an if statement?
A
An if statement allows a program to carry out different actions depending on the nature of the data to be processed
An if statement is like a fork in the road. Depending upon a decision, different parts of the program are executed.
Ex:
temperature has a value of 88
if temperature > 90:
print(“It is”)
else:
print(“It is not”)
print (“a hot day.”)
Prints:
It is not
a hot day.
2
Q
A