Page 532 - Computer Science V2.0 Class 11
P. 532
5. Write a program to display the area and perimeter of a rectangle. Use user-defined functions for each.
6. Write a function txtDigit() that accepts a numeric digit as an argument and returns the digit in words.
Thereafter invoke the function and display the output.
For example, for the input 5, it should display: five
7. Write a program that reads a character as a user input, checks whether it is an alphabet, digit or a special character,
and displays output such as the following:
& is a special character.
7 is a digit.
8. Write a program to develop a calculator. It accepts two numbers and a character operator (+, -, *, /) and displays the
sum, difference, product, quotient, and remainder, respectively. An appropriate message should be displayed if any
other character operator is passed as an operator. (Note: Make separate user defined functions for each operator)
9. Write a program to accept a number and compute its factorial.
10. Write a program to print the factors of a given number.
11. Develop a user defined functions that takes a number as an argument and returns its reverse.
12. Write programs in Python to print the following patterns:
Python Patterns
13. Write a function that accepts two strings as arguments and checks whether the second string is a substring
(forms part) of the first string. If yes, the function should display the starting index that marks the beginning of
the second string; otherwise, it should display 'Substring DOES NOT exist'.
14. Write a program that accepts two strings and appends the shorter string after the longer one. For example, if
string1 is 'Hi' and string2 is 'Hello', the output would be 'HelloHi'.
15. Write a function that accepts a list of n numbers as argument and returns the largest number. Do not use the built
in methods, instead develop a function of your own to find the largest number in the list.
16. Write a program that accepts n strings and appends them to an empty list one by one to form a list of strings.
Finally, traverse the list to display all strings that begin with a vowel.
17. Write a program that displays alternate elements of a list.
18. Write a function that accepts a list of n numbers and returns the number that appears the maximum number of
times.
19. Write a program that accepts n numbers and stores them in a tuple. Thereafter, the program prints square of odd
numbers and square root of even numbers.
518 Touchpad Computer Science (Ver. 2.0)-XI

