-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
82 lines (57 loc) · 2.38 KB
/
main.py
File metadata and controls
82 lines (57 loc) · 2.38 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
65
66
67
68
69
70
71
72
73
74
75
76
77
# rules 1: Comparing on the basis of follower count. If user got the person with highest count he scores 1 point and the option selected by him whether A or B for the next turn it becomes A.
# If the winning option is on A and keeps on winning it stays there and option will keep on change.
# rule 2: Game stops when the user get wrong answer. At the end it shows the score.
# rule 3: If the user gets the correct answer, the game continues with the conditions of rule one
from art import logo, vs
from game_data import data
import random
from replit import clear
print(logo)
def get_random_account(data):
i=random.randint(0,len(data)-1)
return i
score = 0
win_loose=True
a=get_random_account(data)
print(f"Compare A: {data[a]['name']}, a {data[a]['description']}, from {data[a]['country']}")
print(vs)
b=get_random_account(data)
if b==a and a != len(data)-1:
b += 1
elif b==a and a == len(data)-1:
b -= 1
print(f"Against B: {data[b]['name']}, a {data[b]['description']}, from {data[b]['country']}")
user_choice = input("Who has more followers? Type 'A' for A or 'B' for B: \n")
while win_loose==True:
if user_choice == 'A' and data[a]['follower_count'] > data[b]['follower_count']:
score +=1
b=get_random_account(data)
clear()
print(logo)
print(f"Your score {score}")
print(f"Compare A: {data[a]['name']}, a {data[a]['description']}, from {data[a]['country']}")
print(vs)
if b==a and a != len(data)-1:
b += 1
elif b==a and a == len(data)-1:
b -= 1
print(f"Against B: {data[b]['name']}, a {data[b]['description']}, from {data[b]['country']}")
user_choice = input("Who has more followers? Type 'A' for A or 'B' for B: \n")
elif user_choice == 'B' and data[a]['follower_count'] < data[b]['follower_count']:
score +=1
a=b
b=get_random_account(data)
clear()
print(logo)
print(f"Your score {score}")
print(f"Compare A: {data[a]['name']}, a {data[a]['description']}, from {data[a]['country']}")
print(vs)
if b==a and a != len(data)-1:
b += 1
elif b==a and a == len(data)-1:
b -= 1
print(f"Against B: {data[b]['name']}, a {data[b]['description']}, from {data[b]['country']}")
user_choice = input("Who has more followers? Type 'A' for A or 'B' for B: \n")
else:
print(f"Sorry, your aswer was wrong. Your score final {score}")
win_loose=False