-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhigher_lower.py
103 lines (59 loc) · 1.64 KB
/
higher_lower.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# generate random number
#IMPORT RANDOM NUMBER
#user randint to random integer
# display logo
#import art
#fetch game data function fetch_game data
# first import game_data
# read to random entries in the list
#make sure two random numbers are not staticmethod
#the one list with more followers keep it more
#read again
from art import logo,vs
from game_data import data
from random import randint
from replit import clear
def pick_random_num():
return randint(1,49)
def fetch_game_data(num):
return data[num]
def who_has_more(count_a,count_b):
if count_a > count_b:
return 'a'
else:
return 'b'
list_A = []
list_B = []
score = 0
game = True
while game:
if score == 0:
num_a = pick_random_num()
num_b = pick_random_num()
print(num_a,num_b)
list_A = fetch_game_data(num_a)
list_B = fetch_game_data(num_b)
clear()
print(logo)
if score > 0:
print(f"you are correct, current score {score}")
if more_followers == 'a':
num_b = pick_random_num()
print(num_b)
list_B = fetch_game_data(num_b)
else:
num_a = pick_random_num()
print(num_a)
list_A = fetch_game_data(num_a)
print(f"Compare A: {list_A['name']},"\
f"{list_A['description']} from {list_A['follower_count']}")
print(vs)
print(f"Againt B:{list_B['name']},"\
f"{list_B['description']} from {list_B['follower_count']}")
user_choice = input("Who has more followers a or b ").lower()
more_followers=who_has_more(list_A['follower_count'],list_B['follower_count'])
if user_choice == more_followers:
score = score + 1
else:
game = False
print(f"You are wrong, your score {score}")