-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram26.py
More file actions
74 lines (56 loc) · 1.49 KB
/
program26.py
File metadata and controls
74 lines (56 loc) · 1.49 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
#List as input from user--------
n = input("Enter a text or number : ")
#10 20 30 40 50 = sum ?
list = n.split()
sum = 0
for num in list:
sum = sum + int(num)
print(sum)
#List as input from user--------
n = input("Enter a text or number : ")
print(n)
list = n.split()
sum = 0
for x in list:
sum = sum + int(x)
print(sum)
#List as input from user--------
n = input("Enter any text or number : ")
print("Numbers are : ",n)
list = n.split()
sum = 0
for num in list:
sum = sum + int(num)
print("Sum : ",sum)
#List as input from user--------
numOfDigits = 0
numOfLetters = 0
numOfWords = 0
text = input("Enter a text or numbers : ")
for x in text:
if x>= "a" and x<="z":
x = x.lower()
numOfLetters = numOfLetters + 1
elif x>="0" and x<="9":
numOfDigits = numOfDigits + 1
elif x == " " :
numOfWords = numOfWords + 1
print("numOfLetters : ",numOfLetters)
print("numOfDigits : ",numOfDigits)
print("numOfWords : ",numOfWords + 1)
#List as input from user--------
numOfDigits = 0
numOfLetters = 0
numOfWords = 0
text = input("Enter a text or number : ")
for x in text:
x = x.lower()
if x>="a" and x<="z":
numOfLetters = numOfLetters + 1
elif x>="0" and x<="9":
numOfDigits = numOfDigits + 1
elif x==" ":
numOfWords = numOfWords + 1
print("numOfLetters : ",numOfLetters)
print("numOfDigits : ",numOfDigits)
print("numOfWords : ",numOfWords + 1)