-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.py
More file actions
55 lines (36 loc) · 1.26 KB
/
menu.py
File metadata and controls
55 lines (36 loc) · 1.26 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
while True:
q = input("Do you want to start?(y/n):")
while q.lower() not in ["y","n"]:
print("Enter y or n")
q = input("Do you want to start?(y/n):")
if q.lower() == "n":
break
x = input("Enter a string:")
print("What do you want to do?:\na.count number of capital letters, vowels, numbers and special characters.\
\nb.check whether the string is palindrome or not.")
y = input("Enter option:")
while y.lower() not in ["a","b"]:
print("Enter a or b")
y = input("Enter option:")
if y.lower() == "a":
cap = 0
v = 0
num = 0
sp = 0
for i in x:
if i.isupper():
cap += 1
if i.isdigit():
num += 1
if i.isalnum() == False:
sp += 1
if i.upper() in "AEIOU":
v += 1
print("Number of capital letters are:",cap,"\nNumber of vowels are:",v,\
"\nNumber of numbers are:",num,"\nNumber of special characters are:",sp)
if y.lower() == "b":
xalt = ""
for i in x:
xalt = i + xalt
if xalt == x:
print(x,"Is a palindrome.")