“Kondisi dalam Python” Kode Jawaban

Kondisi Python

ensoleille = False
neige = True

if ensoleille:
   print("on va à la plage !")
elif neige:
   print("on fait un bonhomme de neige")
else:
   print("on reste à la maison !")
moi_crn

Kondisi Python

with_sun = True
in_week = False

if with_sun and not in_week:
   print("we go to the beach !")
elif with_sun and in_week:
   print("we go to work !")
else:
   print("we stay at home !")
moi_crn

Kondisi dalam Python

# How conditions work
if condition:
	# if condition met
	# code here
elif condition2: # (else if) checked if the first condition is false
  	# if condition2 met
    # code here
elif condition3: # elif can be chained
    # if condition3 met
	# code here
else:
  	# if none of the conditions are met
    # code here

    
# example

if name == "bob": # ex. a == b (is a equal to b)
    print("the wifi password is 1234")
    
elif name == "jake": # if the first condition is not met python checks this one
    print("the secret formula is under the bed")

else: # if none of the conditions are met
    print("sorry i don't know who you are")

    
# Other Example
if age >= 18:
    print('You can go in')
else:
    print('you cannot pass, you are underage')
sxnsei dev

Kondisi Python

avec_soleil = True
en_semaine = False

if avec_soleil and not en_semaine:
   print("on va à la plage !")
elif avec_soleil and en_semaine:
   print("on va au travail !")
else:
   print("on reste à la maison !")
moi_crn

Jawaban yang mirip dengan “Kondisi dalam Python”

Pertanyaan yang mirip dengan “Kondisi dalam Python”

Lebih banyak jawaban terkait untuk “Kondisi dalam Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya