Worksheet 4
Worksheet 4
def fun(s):
k= len(s)
m=""
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'bb'
print(m)
fun('CS Worksheet#4')
Identify the formal and actual parameters in the above code snippet.
Q7 The code given below accepts a number as an argument and returns the reverse 2
number. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
Q8 (a) Write a function in Python, which accepts a list Arr of numbers, the function will 2
replace the even number by value 10 and multiply odd number by 5.
OR
(b) Write a function that replaces elements having even values with its half and
elements having odd values with twice its value in a list.