Changes in playground
This commit is contained in:
40
playground.py
Normal file
40
playground.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# def hello():
|
||||||
|
# # Print 3 greetings:
|
||||||
|
# print("Good morning!")
|
||||||
|
# print("Good afternoon!")
|
||||||
|
# print("Good night!")
|
||||||
|
|
||||||
|
# hello()
|
||||||
|
# hello()
|
||||||
|
# print('One more time')
|
||||||
|
# hello()
|
||||||
|
|
||||||
|
# def say_hello(name):
|
||||||
|
# print(f'Hello {name}')
|
||||||
|
|
||||||
|
# say_hello('Marc')
|
||||||
|
|
||||||
|
import random
|
||||||
|
|
||||||
|
def get_answer(random_number):
|
||||||
|
if random_number == 1:
|
||||||
|
return 'It is certain!'
|
||||||
|
elif random_number == 2:
|
||||||
|
return 'It is decidedly so.'
|
||||||
|
elif random_number == 3:
|
||||||
|
return 'Yes'
|
||||||
|
elif random_number == 4:
|
||||||
|
return "Doubtful"
|
||||||
|
elif random_number ==5:
|
||||||
|
return 'Not likely'
|
||||||
|
else:
|
||||||
|
return "No way in hell"
|
||||||
|
|
||||||
|
print("Ask a yes or no question:\n>")
|
||||||
|
input()
|
||||||
|
r = random.randint(1,5)
|
||||||
|
fortune = get_answer(r)
|
||||||
|
print(fortune)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user