important point ・ **: ** after the conditional expression ・ Else if is ** elif ** ・ When the conditional expression is equal on the left and right, ** == **
if money > total_price:
print("Apples" + str(count) + "I bought one")
print("The balance is" + str(money - total_price) + "It's a yen")
elif money == total_price:
print("Apples" + str(count) + "I bought one")
print("The wallet is empty")
else:
print("Not enough money")
print("I couldn't buy an apple")
and Satisfy both conditions
if time > 10 and time < 15:
or Either condition is met
if time == 10 or time == 15:
not Negation of conditions
if not time == 20:
Unlike js, the number of = when the left and right are equal changes.
Recommended Posts