-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions2.py
42 lines (37 loc) · 1.04 KB
/
functions2.py
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
question = int(input("Question #? "))
if question == 1:
def caseFind(string, y):
caseUp = 0
caseDown = 0
k = 0
x = len(string)
string2 = string.upper()
for k in range(0, x):
ch1 = string[k]
ch2 = string2[k]
if (ch1 != ' ' and ch2 != ' '):
if (ch1 == ch2):
caseUp = caseUp + 1
else:
caseDown = caseDown + 1
if y == 1:
return (caseUp)
elif y == 2:
return (caseDown)
else:
return ()
strInput = input("Enter a string: ")
print("\nNo. of Uppercase letters:", caseFind(strInput, 1))
print("No. of Lowercase letters:", caseFind(strInput, 2))
if question == 2:
def calc(x, y, z):
if z == 1:
return (x+y)
elif z == 2:
return (x-y)
elif z == 3:
return (x*y)
elif z == 4:
return (x/y)
else:
return ("Incorrect Operation")