If/elif/else
elif
is used if the previous condition is not met, but the current one is.
12345678price = 999 if price > 1000: print('The price is high. I won't buy it') elif price > 500: print('I will think if I need it') else: print('I will definitely buy it')
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 4
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 2.7
If/elif/else
Sveip for å vise menyen
elif
is used if the previous condition is not met, but the current one is.
12345678price = 999 if price > 1000: print('The price is high. I won't buy it') elif price > 500: print('I will think if I need it') else: print('I will definitely buy it')
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 4