Assignment Day 1
Assignment Day 1
Decision making
D1. Write a program to find greatest of three numbers.
D2. Write a program to find the grade of a student for marks out pf 100.
• Marks 85 and above - grade “A”
• Marks between 70 to 84, - grade “B”
• Marks between 55-69, -grade “C”
• Marks between 40-54, -grade “D”
• Marks below 40, - “fail”
D3. Find if given number is even or odd.
D4. Get input a number from user (maximum 4 digits) and decide whether number is a
single/double/triple/four digit number.
String
S1. Python program to check whether the string is Palindrome
S2. Reverse words in a given String in Python
S3. Python Program to identify in a strings the name, position and counting of vowels.
S4. Count the Number of matching characters in a pair of string
S5. Python program for removing i-th character from a string
List
Li1. Write a python program to find the sum of all numbers in a list.
Li2. Write a python program to find largest number in a given list without using max().
Li3. Write a python program to print all even numbers from a given list.
Li4. Write a python program to create a list of even numbers and another list of odd numbers
from a
given list.
Li5. Write a python program to remove repeated elements from a given list without using built-
in methods.
Li6. Write a python program to sort a given list of numbers without using sort() function.
Tuple
T1. Write a Python program to find the index of an item of a tuple.
T2. Write a Python program to find the length of a tuple.
T3. Write a Python program to reverse a tuple.
T4. Write a Python program to sort a list of tuple by its float element.
Sample data: [('item1', '12.20'), ('item2', '15.10'),
('item3', '24.5')]
Expected Output: [('item3', '24.5'), ('item2', '15.10'),
('item1', '12.20')]
Set
Se1. Write a Python program to create an intersection of sets.
Se2. Write a Python program to create a union of sets.
Se3. Write a Python program to create set difference.
Se4. Write a Python program to check if two given sets have no elements in common.
Se5. Write a Python program to remove the common element of a 2nd set from the 1st set
Loops
L1. Python Program to Find the Factorial of a Number
L2. Python Program to Display the multiplication Table
L3. Python Program to Print the Fibonacci sequence
L4. Python Program to Check Armstrong Number
L5. Python Program to Find the Sum of first 50 Natural Numbers
Function
F1. Write a Python function to print the even numbers from a given list. And call it.
F2. Write a Python function fact to calculate the factorial of a number. And call it to calculate
ncr=fact(n)/(fact(r)*fact(n-r))