-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (51 loc) · 1.67 KB
/
Copy pathmain.py
File metadata and controls
64 lines (51 loc) · 1.67 KB
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
import os
def clear(): # Cross-platform clear screen
os.system('cls' if os.name == 'nt' else 'clear')
from art import logo,vs
import random
from game_data import data
def play_game():
random_1=random.randint(0,49)
score=0
should_continue=True
print(logo)
while should_continue:
random_2=random.randint(0,49)
choice1=data[random_1]
choice2=data[random_2]
if choice1==choice2:
choice2=data[random.randint(0,49)]
print(f"Compare A: {choice1['name']}, a {choice1['description']} from {choice1['country']}")
print(vs)
print(f"Compare B: {choice2['name']}, a {choice2['description']} from {choice2['country']}")
user_input= input("Who has more followers on Instagram? Type 'A' or 'B': ").lower()
if int(choice1['follower_count']) > int(choice2['follower_count']):
correct_answer="A"
else:
correct_answer="B"
if correct_answer=="A":
if user_input=="a":
score+=1
clear()
print(logo)
print(f"You're right! Current score: {score}")
else:
print(f"Sorry, that's not right. It was {choice1['name']}. Final score = {score}")
should_continue=False
if correct_answer=="B":
if user_input=="b":
score+=1
clear()
print(logo)
print(f"You're right! Current score: {score}")
else:
print(f"Sorry, that's not right. It was {choice2['name']}. Final score = {score}")
should_continue=False
random_1=random_2
play_game()
while input("If you want to play type 'Y', else type 'N': ").lower() == "y":
clear()
play_game()
else:
clear()
print("Thank you for playing! Come back soon!")