-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_11Loops.py
More file actions
78 lines (54 loc) · 1.02 KB
/
Python_11Loops.py
File metadata and controls
78 lines (54 loc) · 1.02 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
#LOOPS
"""
What is the use of loops ?
When we have to execute the part of a particular program or whole program multiple times
until the satisfaction of the user and problem statement.
You need to run program until the condition of the user is satisfied
"""
# Types of LOOP
"""
1- While
2- For loop
"""
#while loop
""""
Syntax:
while condition:
statements
"""
#Condition print my name 10 times
# name = input("Enter name : ")
# i=0
# while i < 10:
# print(name)
# i=i+1
# j = input("How many times do you want to repeat : ")
# while i < int(j):
# print(name)
# i = i + 1
"""
Display number from 1 to 10
"""
i=1
while i <=10:
print(i)
i += 1
#Line 52 will have no relation with while block⭐⭐⭐⭐⭐⭐⭐⭐⭐
"""
If user says any number then print its table
input : number (say 1)
output:
1 * 1 = 1
1 * 2 = 2
1 * 3 = 3
.
.
.
1 * 10 = 10
"""
number = input("\n\n\nEnter number: ")
i=1
while i <=10:
prod = int(number)*i
print( int(number)," * ",i, " = ",prod)
i += 1