Suryadatta Education Foundations
Suryadatta Institute of Management & Mass Communication(SIMMC)
MCA Department
MCA-I SEM-I
A.Y.2024-25
Subject: IT 11- Python Programming
Assignment No-2
1. Ask the user for a number. Depending on whether the number is even or
odd, print out an appropriate message to the user. Hint: how does an even /
odd number react differently when divided by 2?
Extras:
a. If the number is a multiple of 4, print out a different message.
b. Ask the user for two numbers: one number to check (call it num) and one
number to divide by (check). If check divides evenly into num, tell that
to the user. If not, print a different appropriate message.
2. Write a program that determines a student’s grade. The program will read three
scores and determine the grade based on the following rules:
-if the average score =90% =>grade=A
-if the average score >= 70% and <90% => grade=B
-if the average score>=50% and <70% =>grade=C
-if the average score<50% =>grade=F
3. Write a Python program to count the number of even and odd numbers from a
series of numbers.
Sample numbers : numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9)
Expected Output :
Number of even numbers : 5
Number of odd numbers : 4
4. Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.
Note : Use 'continue' statement.
Expected Output : 0 1 2 4 5
5. Write a Python program to get the Fibonacci series between 0 to 50.
Note : The Fibonacci Sequence is the series of numbers :
0, 1, 1, 2, 3, 5, 8, 13, 21, ....
Every next number is found by adding up the two numbers before it.
Expected Output : 1 1 2 3 5 8 13 21 34
6. Write a Python program which takes two digits m (row) and n (column) as input
and generates a two-dimensional array. The element value in the i-th row and j-th
column of the array should be i*j.
Note :
i = 0,1.., m-1
j = 0,1, n-1.
Test Data : Rows = 3, Columns =
4 Expected Result : 0, 0, 0, 0
0, 1, 2, 3
0, 2, 4, 6
7. Write a Python program which accepts a sequence of comma separated 4 digit
binary numbers as its input and print the numbers that are divisible by 5 in a
comma separated sequence.
Sample Data : 0100,0011,1010,1001,1100,1001
Expected Output : 1010
8. Write a Python program to find numbers between 100 and 400 (both included)
where each digit of a number is an even number. The numbers obtained should be
printed in a comma-separated sequence.
9. Write a Python program to print alphabet pattern 'A',B,D,E,H,T,F,X,W,M,N,Z.
For Eg of A.
***
* *
* *
*****
* *
* *
* *
10. Write a Python program that accepts a word from the user and reverse it
11. Write a Python program that accepts a string and calculate the number of
digits and letters.
Sample Data : Python 3.2
Expected Output :
Letters 6
Digits 2
12. Wite A Python program to use a Math Function in python and explain its use (Any
10 Built in Function)
13. Write A Python programming to use a Date() And Time() Function in Python Its
Use (Any 5 Built in finction)
14. Write a Python program that reads two integers representing a month and day
and prints the season for that month and day.
Expected Output:
Input the month (e.g. January, February etc.): july
Input the day: 31
Season is autumn
15. Write a Python program to find the median of three values.
Expected Output:
Input first number: 15
Input second number: 26
Input third number: 29
The median is 26.0
16. Write a Python program to get next day of a given date.
Expected Output:
Input a year: 2016
Input a month [1-12]: 08
Input a day [1-31]: 23
The next date is [yyyy-mm-dd] 2016-8-24
17. Write a Python program to calculate the sum and average of n integer
numbers (input from the user). Input 0 to finish.
18. Write a Python program to construct the following pattern, using a nested loop
number.
Expected Output:
1
22
333
4444
55555
666666
7777777
88888888
999999999
19. Write A Python Program to Convert Decimal to Binary, Octal and
Hexadecimal(Use user defined Ask the user for a number. Depending
on whether the number is even or odd, print out an appropriate
message to the user. Hint: how does an even / odd number react
differently when divided by 2?
20.
1. Write A Python Program to Find ASCII Value of Character.
2. Write A Python Program to Find HCF or GCD and LCM.
3. Write A Python Program to Swap Two Variables
4. Write A Python Program to Generate a Random Number.
5. Write A Python Program to Convert Kilometers to Miles.
6. Write a program for calculate for factorial.
7. Write a program for insertion, bubble, selection.