-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasswork4.py
More file actions
72 lines (47 loc) · 1.24 KB
/
classwork4.py
File metadata and controls
72 lines (47 loc) · 1.24 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
64
65
66
67
68
# Creating a boolean variable true
#keep_going = True
#while keep_going:
#first_number = int(input("Enter First Num: "))
#second_number = int(input("Enter Second Num: "))
#print(first_number + second_number)
# Nested conditional statement in while loop
#repeat = input("Try again: yes or no: ")
#if repeat != "yes":
#keep_going = False
# Exercise 1
#count = 0
#while count < 10:
#print(count)
#if count == 4:
#break
#count = count + 1
# Exercise 2
#password = ""
#while password != "secret":
# Prompting user to enter password
#user_password = input("Enter your password: ")
#if user_password == "secret":
#break
#count = 0
#while count < 10:
#count = count + 1
#if count == 4:
#continue
#print(count)
# Exercise 3
#count = 0
#while count < 10:
#count = count +1
#if count == 2 or count == 4 or count == 6 or count == 8 or count == 10:
#continue
#print(count)
#Exercise 4
attempts = 0
while attempts < 3:
attempts +=1
user_guess = input("Can you guess my lucky number?: ")
if user_guess == ("7"):
print("You won!!")
break
else:
print(" You have exceeded the maximum attempts and lost the game!!")