-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay2.py
66 lines (63 loc) · 2.25 KB
/
Day2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# We have a situation, where we need to use list and get details of students in every cities where we have ANSSIR
# so we can decide which city will host the next convention, judging from the man power.
import random
Moscow =[]
Petersburg = []
Krasnodar = []
Rostov =[]
Belgorod =[]
ANSSIR = [Moscow, Petersburg, Krasnodar, Belgorod, Rostov]
your_city = input("What city are you from? ")
your_name = input('What is your name? ')
name = your_name.upper()
city = your_city.lower()
if your_city == "moscow":
Moscow.append(name)
print(ANSSIR)
#I don't know how to make use of the same code again, i would have love to continue to append
#Untill the user choose to end the cycle.
#working with random
#Creating a simple addition game
print("Welcome to my simple addition game.")
first_number = random.randint(0,100)
second_number = random.randint(0,100)
operation = input('''
Which operation would you like to do:
1 for + (addition)
2 for * (multiplication)
3 for / (division)
4 for - (subtraction)
0 to exit the game
\n''')
if operation == "1":
print(f'What is the sum of {first_number} + {second_number}')
answer = int(input("Answer here = "))
if answer == first_number + second_number:
print ("That is correct!")
else:
print("Ooops, you got that wrong...")
elif operation == "2":
print(f'What is the multiplication of {first_number} * {second_number}')
answer = int(input("Answer here = "))
if answer == first_number * second_number:
print("That is correct!")
else:
print("Ooops, you got that wrong...")
elif operation == '3':
print(f'What is the division of {first_number} / {second_number}')
answer = int(input("Answer here = "))
if answer == first_number / second_number:
print("That is correct!")
else:
print("Ooops, you got that wrong...")
elif operation == "4":
print(f'What is the subtraction of {first_number} - {second_number}')
answer = int(input("Answer here = "))
if answer == first_number - second_number:
print("That is correct!")
else:
print("Ooops, you got that wrong...")
elif operation == "0":
exit()
else:
print("Please try again, and pick between the given options. Thank you")