-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday2.py
More file actions
63 lines (50 loc) · 1.25 KB
/
Copy pathday2.py
File metadata and controls
63 lines (50 loc) · 1.25 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
#Functions
# def sum(a,b):
# print(a+b)
# sum(2,3)
# #Match Case
# # what is aiml->
# # thankyou->
# # invalid->
# command = input("Give Command: ")
# match command:
# case "what is aiml":
# print("AIML is a field which works on finding patterns")
# case "thankyou":
# print("glad to help you")
# case _:
# print("invalid command")
# range function
# for i in range(4):
# print(i) #op 0123
# for i in range(4,10):
# print(i) #op 4 to 9
# for i in range(4,20,3): #range(start,stop,step)
# print(i) #op 4 to 19 in 3 steps
# while True:
# print("Prathmesh")
import random
randomNumber = random.randrange(0,3)
print(randomNumber)
secretKey = random.randint(0,6)
print(secretKey)
attempts = 3
# while attempts!=0:
# guess=int(input("enter number: "))
# if guess==secretKey:
# print("Correct Guess!")
# break
# else:
# print("try again")
# attempts = attempts-1
while attempts>0:
guess = int(input("enter secretkey in the given range 1,6: "))
if guess>secretKey:
print("guess is greater")
elif guess<secretKey:
print("guess is lesser")
else:
print("correct Guess!!")
break
attempts-=1
print("Remaining attempts: ",attempts)