samedi 16 octobre 2021

if-then statements and line divider

I'm new to coding (first day). I have a value that's 10, so when I use this code, I get both the first print function and the second one. How can I code python to only show me the second print function?

if float(exchange_rate) >= 8:
    print("f")
if float(exchange_rate) >=9:
    print("o")

Also, is there a way for me to enter a divider between two pieces of code? Like a line that divides the results into two separate parts?

Aucun commentaire:

Enregistrer un commentaire