Skip to content

Commit 046bf1b

Browse files
authored
thank you so much XXXDark303
Fixed Countries.py logic and added a difficulty system
2 parents 575f460 + 839f267 commit 046bf1b

1 file changed

Lines changed: 90 additions & 5 deletions

File tree

Other Programs/Countries.py

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,121 @@
11
import random
22
import time
3+
import os
34

4-
randomcountry = random.randint(1, 10)
5+
def clear():
6+
if os.name == "nt":
7+
os.system('cls')
8+
else:
9+
os.system('clear')
10+
11+
print("In this program you will need to guess the country I am thinking of")
12+
13+
print("")
14+
print("")
15+
16+
print("Difficulties:")
17+
print("1. Normal")
18+
print("2. Hard")
19+
print("")
20+
print("")
21+
22+
difficulty = input("Please choose difficulty: ")
23+
24+
difficultylevel = int(difficulty)
25+
clear()
26+
27+
if difficultylevel < 2:
28+
randomcountry = random.randint(1, 10)
29+
else:
30+
randomcountry = random.randint(1, 20)
531
wrongguesses = 0
632
if randomcountry == 1:
733
country = "Spain"
34+
region = "Europe"
835

936
if randomcountry == 2:
1037
country = "US"
38+
region = "America"
1139

1240
if randomcountry == 3:
1341
country = "UK"
42+
region = "Europe"
1443

1544
if randomcountry == 4:
1645
country = "Poland"
46+
region = "Europe"
1747

1848
if randomcountry == 5:
1949
country = "France"
50+
region = "Europe"
2051

2152
if randomcountry == 6:
2253
country = "Australia"
54+
region = "Oceania"
2355

2456
if randomcountry == 7:
2557
country = "Italy"
58+
region = "Europe"
2659

2760
if randomcountry == 8:
2861
country = "Portugal"
62+
region = "Europe"
2963

3064
if randomcountry == 9:
3165
country = "Finland"
66+
region = "Europe"
3267

3368
if randomcountry == 10:
3469
country = "Scotland"
70+
region = "Europe"
3571

36-
print("In this program you will need to guess the country I am thinking of")
37-
print("I am thinking of a country between London and Japan. Good luck.")
72+
if randomcountry == 11:
73+
country = "Indonesia"
74+
region = "Asia"
75+
76+
if randomcountry == 12:
77+
country = "India"
78+
region = "Asia"
79+
80+
if randomcountry == 13:
81+
country = "Japan"
82+
region = "Asia"
83+
84+
if randomcountry == 14:
85+
country = "Germany"
86+
region = "Europe"
87+
88+
if randomcountry == 15:
89+
country = "Denmark"
90+
region = "Europe"
91+
92+
if randomcountry == 16:
93+
country = "Algeria"
94+
region = "Africa"
95+
96+
if randomcountry == 17:
97+
country = "Iceland"
98+
region = "Europe"
99+
100+
if randomcountry == 18:
101+
country = "Ukraine"
102+
region = "Europe"
103+
104+
if randomcountry == 19:
105+
country = "Greece"
106+
region = "Europe"
107+
108+
if randomcountry == 20:
109+
country = "Ireland"
110+
region = "Europe"
111+
112+
113+
114+
115+
if difficultylevel < 2:
116+
print(f"I am thinking of a country in {region}. Good luck.")
117+
else:
118+
print("I am thinking of a country between the US and Japan. Good luck.")
38119

39120
while True:
40121
guess = input("Please enter your guess: ")
@@ -53,20 +134,24 @@
53134
if randomphrases == 5:
54135
print("Wrong guess")
55136
if guess.lower() == country.lower():
56-
wonrandomphrases = random.randint(1, 4)
137+
wonrandomphrases = random.randint(1, 3)
57138
if wrongguesses > 5:
58139
print("It's not that one you noob")
59140
time.sleep(2)
60141
print("Nah just kidding you got it right")
61142
input()
143+
exit()
62144

63145
if wonrandomphrases == 1:
64146
print("You won!")
65147
input()
148+
exit()
66149
if wonrandomphrases == 2:
67150
print("Congratulations, you guessed it right!")
68151
input()
152+
exit()
69153

70-
if wonrandomphrases == 4:
154+
if wonrandomphrases == 3:
71155
print("GGs, you guessed it right!")
72156
input()
157+
exit()

0 commit comments

Comments
 (0)