-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_funcs.py
57 lines (41 loc) · 1.67 KB
/
game_funcs.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
import game_data
import random
def choose_person(choice, person=" "):
people = game_data.data
index_num = random.randint(0,49)
name = people[index_num]['name']
description = people[index_num]['description']
country = people[index_num]['country']
print(f"Person/Organization {choice}: {name}, {description}, from {country}")
if name == person:
choose_person(choice, person)
return name, people[index_num]["follower_count"]
def player_guess():
print("Who has more more followers?")
return input("Type A or B: ").upper()
def guess_a(person_a, followers_a, person_b, followers_b, games_won):
if followers_a > followers_b:
print("\nCorrect!")
print(f"{person_a} has {followers_a} million followers and {person_b} has {followers_b} million followers.\n")
games_won += 1
return games_won
else:
print("\nWrong!")
print(f"{person_a} has {followers_a} million followers and {person_b} has {followers_b} million followers.\n")
return games_won
def guess_b(person_a, followers_a, person_b, followers_b, games_won):
if followers_a > followers_b:
print("\nWrong!")
print(f"{person_a} has {followers_a} million followers and {person_b} has {followers_b} million followers.\n")
return games_won
else:
print("\nCorrect!")
print(f"{person_a} has {followers_a} million followers and {person_b} has {followers_b} million followers.\n")
games_won += 1
return games_won
def continue_play():
print("Continue playing?")
answer = input("Type y for yes or n for no: ").lower()
if answer == "n":
return False
return True