If Statement


Code and Output

ifstatement
#from random import randint
dice = "6"
guess = input("Guess input: ")

if guess == dice:
print ("Wohoo you got lucky")


#if guess == dice:
#print ("Wohoo you got lucky")
#else:
#print ("You guessed wrong")


'
ifelsestatement
dice = 6
guess = 2

if (guess!=dice):
print ("Wohoo you got lucky")
else:

print ("You guessed wrong")



elifstatement
dice = 6
guess = 1

if (guess==dice):
print("Wohoo you got lucky")

elif (guess>dice):
print("You guessed Higher")
else:
print("You guessed lower")


Comments

Popular posts from this blog

WAN Technology

LO3 - Know the features and functions of information systems

WDD - LO1 - MANAGE SECURE SITES