-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor.py
More file actions
46 lines (28 loc) · 758 Bytes
/
Copy pathfor.py
File metadata and controls
46 lines (28 loc) · 758 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# for loop
# string = "hello"
# # in => membership oprater
# for var in string :
# print(var)
# string = "hello"
# if "o" in string:
# print("o is exists in a string")
# for i in range(5):
# print(i)
# to check how many time one latter come in word same letter
# word = "Artifacil intelligence"
# count = 0
# for ch in word:
# if(ch == "i"):
# count += 1
# print("count of i =",count)
# range in python
# for i in range(1,10):
# print(i)
# for i in range(1,10,2):
# print(i)
# print sum of n number
n = int(input("enter number :"))
sum = 0
for i in range(1,n+1):
sum += i
print("total sum is ", sum)