“Wenn elif und sonst in Python” Code-Antworten

Wenn elf sonst

number = 9

if number < 5: # Condition 1
	print("Less than 5") # Code 1
elif number < 10: # Condition 2
	print("Less than 10") # Code 2
else: # If Condition 1 and 2 are not true
	print("Not less than 5 or 10") # Code 3
Ninja Penguin

Wenn elif und sonst in Python

var_one = input("Give me a number: ")
var_one = int(var_one)
var_two = input("Give me another number: ")
var_two = int(var_two)

if var_one > var_two:
    print(f"First number, {var_one} is bigger")
elif var_one < var_two:
    print(f"Second number, {var_two} is bigger")
else:
    print(f"Both numbers are the same : {var_one}")
Rajitha Amarasinghe

Ähnliche Antworten wie “Wenn elif und sonst in Python”

Fragen ähnlich wie “Wenn elif und sonst in Python”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen