We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a526f3 commit 153830fCopy full SHA for 153830f
Guess the number (computer)/guessthenumber_computer.py
@@ -1,14 +1,13 @@
1
import random
2
3
-def guess(num):
4
- random_number = random.randint(1, num)
5
- guess = 0
6
- while guess != random_number:
7
- guess = int(input(f"Guess the number between 1 & {num}: "))
8
- if guess < random_number:
9
- print("Wrong! Too low...")
10
- elif guess > random_number:
11
- print("Wrong! Too high...")
12
- print(f"Thats Right! Random number is {random_number}")
+max_num = 30
13
14
-guess(10)
+random_number = random.randint(1, max_num)
+guess = 0
+while guess != random_number:
+ guess = int(input(f"Guess the number between 1 & {max_num}: "))
+ if guess < random_number:
+ print("Wrong! Too low...")
+ elif guess > random_number:
+ print("Wrong! Too high...")
+print(f"Thats Right! Random number is {random_number}")
0 commit comments