CPL101 Assignment 1IT AS2024
CPL101 Assignment 1IT AS2024
Phuentsholing: Bhutan
Autumn Semester 2024
CPL101: Introduction to
Programming
[Assignment Questions]
Assignment Topic: Python Program on Function
Module Code/Name: CPL101-Introduction to Programming
Submission Date: 1st October 2024
Submission Time: 9A.M - 1 P.M
General Notes:
1. Attach a plagiarism declaration form.
2. Assignment submission should be a HARD COPY (Hand Written).
3. Strictly follow the submission date and time as mentioned above.
4. Late submission of the assignment will be awarded with ZERO grade.
QUESTIONS
Write Python program for the following questions:
1. Write a non-returning type function to read the numbers until -2 is encountered.
Count all the positive, negative and zeros entered by the user. The function does
not accept any arguments.
2. Write a function (non returning type and no arguments) to read the temperature
in centigrade and display a suitable message according to temperature stated
below.
Temp < 0 then Freezing weather
Temp 0-10 then Very Cold weather
Temp 11-20 then Cold weather
Temp 21-30 then Normal in Temp
Temp 31-40 then Its Hot
Temp >40 then Its Very Hot
3. Write a non-returning type function that accepts one argument i.e. the entered
character. If the character entered is in lower case, then convert it into uppercase
and if the character entered is in uppercase, then convert it into lowercase.
4. Write a recursive function to calculate and display the sum of N natural numbers.
5. Write a function that accepts two arguments and print the series : 100, 90, 80,
70, 60, 50, 40, 30, 20, 10, 0.
[Note: The arguments determine the starting and ending points of the series to
be printed]
6. Write a function to print the given series:
1+2/4+3/9+4/16+5/25+6/36+7/49+8/64+9/81+10
7. Write a returning type function that accepts two arguments (base and power
values) and calculates the resultant.
[Note: Use any of the loops to calculate. Do not use any of the inbuilt functions or
operators]
8. Calculation of the choice based on the menu list as given below upon the selection
from 1-3. The menu output should be designed as follows:
Select your option from 1-3:
1. A recursive function to print Fibonacci series
2. A non-returning type function to print the multiplication table
3. A non-returning type function that calculates the product of all N
natural number