#04 Flowchart Problems
Flowchart
Code
import random as r
def celc_far():
celcius=int(input('Enter the Celsius you want to be translated: '))
fahrenheit=(celcius*1.8+32)
print('the fahrenheit:',fahrenheit)
def rand_number():
highest=int(input('Enter the highest number you can guess: '))
answer=r.randint(1,highest)
guess1=int(input('Guess the first number: '))
if guess1==answer:
print('Well done, you got it first try')
exit()
guess2=int(input('Guess the second number: '))
if guess2==answer:
print('Well done, you got it second try')
exit()
guess3=int(input('Guess the third number: '))
if guess3==answer:
print('Well done, you got it third try')
exit()
else:
print('You did not guess the number')
def rock_paper_scissors():
player=input(int('Enter your input (1 = Rock, 2 = Paper & 3 = Scissors)'))
cpu=r.randint(1,3)
if player==cpu:
print('Tie')
elif player==1 and cpu==2:
print('CPU win')
elif player==1 and cpu==3:
print('Player win')
elif player==2 and cpu==1:
print('CPU win')
elif player==2 and cpu==3:
print('Player win')
elif player==3 and cpu==1:
print('CPU wins')
else:
print('Player wins')
celc_far()
rand_number()
rock_paper_scissors()