- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhileStatement.py
More file actions
Latest commit
29 lines (24 loc) · 600 Bytes
/
Copy pathwhileStatement.py
File metadata and controls
29 lines (24 loc) · 600 Bytes
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
number=23
running=True
whilerunning:
guess=int(input('Enter an integer : '))
ifguess==number:
print('Congratulations! you guessed it. ')
# this causes the while loop to stop.
running=False
elifguess<number:
print('No, its a little higher than that.')
else:
print('No its a little lower than that.')
else:
print('The while loop is over.')
print('Done!')
'''
Example of while loop
while True:
s = input('enter something : ')
if s == 'quit':
break
print('Length of string is', len(s))
print('done')
'''