-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython while.py
More file actions
96 lines (74 loc) · 1.34 KB
/
python while.py
File metadata and controls
96 lines (74 loc) · 1.34 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
i = 1
while i < 6:
print(i)
i += 1 # this prints i as long as it is less than 6
# while loop needs a break else it continues forever
print()
i = 1
while i < 6: # this prints from 1 till 3
print(i)
if (i == 3):
break
i += 1
print()
i = 0 # this prints 1 till 5 but omits the number 3
while i < 6:
i += 1
if i == 3:
continue
print(i)
print()
i = 1
while i < 6:
print(i)
i += 1
else:
print("i is no longer less than 6")
print()
i = 1
while i < 11: # this prints from 1 till 10
print(i)
if (i == 10):
break
i += 1
print()
i = 1
while i < 11: # this prints from 1 till 10
print(i)
i += 1 # i=i + 1
print()
i = 1
while i < 11: # this prints from 1 till 10
print(i)
count = 1
if count <= 10:
print(count)
print('yes')
else:
print('no')
count = 1
while count <= 10:
print(count)
print('yes')
count += 1
print('no')
def digit10():
print('digit10')
count = 1
while count <= 10:
print(count)
count += 1
#digit10()
def digit():
number = int(input('enter a number of your dreams:'))
count = 1
while count <= number:
print(count)
count += 1
#digit()
def digit_function(number):
count = 1
while count <= number:
print(count)
count += 1
digit_function(9)