-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpro5.py
More file actions
77 lines (64 loc) · 1.38 KB
/
Copy pathpro5.py
File metadata and controls
77 lines (64 loc) · 1.38 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
# lopps in python
# a = 1
# while a <10:
# print(a)
# a += 1
# print("loop is finished")
# while True:
# print("this is an infinte loop")
# b = 10
# while b>=1:
# b= b-1
# print(" valuse of b", b)
# y = 2
# while y<=15:
# print("values of y", y)
# y += 1
# print("loop is finished")
# s= 0
# while s<=10:
# print(f" hello world of {s}")
# s= s+1
# print("loop is finished")
#Print numbers from 1to 100.
# i= 1
# while i<=100:
# print(i)
# i = i+1
# print("loops is finished")
# # print number from 100 to 1
# j= 100
# while j>=1:
# print(j)
# j=j-1
#Print the multiplication table of a number n.
# n= int (input("enter a numbr of your table"))
# i=1
# while i<=10:
# print(f"{n} *{i} = {n*i}")
# i = i+1
# print (" your table is finished")
#Print the elements of the following list using a loop:
# [1,4,9,16,25,36, 49, 64, 81, 100]
#without loop
# nu= ["ch","iron", "captain","super"]
# print(nu[0])
# print(nu[1])
# print(nu[2])
# print(nu[3])
# print(nu[len(nu)-1])
# num = [1,4,9,16,25,36, 49, 64, 81, 100] # with loop
# ind = 0 # traverse means sequence
# while ind<len(num):
# print(num[ind])
# ind = ind+1
# print("lop ended")
#Search for anumber x in this tuple using loop:
# [1, 4, 9, 16, 25, 36, 49, 64, 81,100]
k= ( 1, 4, 9, 16, 25, 36, 49, 64, 81,100, 36)
x=36
i=0
while i < len(k):
if (k[i]==x):
print("found at index",i)
i=i+1