Roll no.
:991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-1
a. Create a program that asks the user to enter their name and their age.
Print out a message addressed to them that tells them the year that they will turn
100 years old
Code:
Output:
b. Enter the number from the user and depending on whether the
number is even or odd, print out an appropriate message to the user.
Code:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Output:
c. Write a program to generate the Fibonacci series.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
d. Conditional Statement : In a company an employee is paid as under: If
his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and
DA =90% of basic salary. If his salary is either equal to or above Rs. 1500,
then HRA= Rs. 500 and DA = 98% of basic salary. If the employee's salary
is input through the keyboard, write a program to find his gross salary.
e. Write a python program to generate the various patterns.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
e. Write a python program to generate the various patterns.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-2
a. Write a program that takes two lists and returns True if they have
at least one common member.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
b. Write a Python program to display sum of list elements:
Code:
Output:
c. Write a program to find even and odd nos from given list:
Code:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-3
3)a.Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21,
34,55,89]and write a program that prints out all the elements of the list
that are less than 5.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
3)b. WAP to display cumulative elements of a given list:
Code:
Output:
3)c. WAP to remove all odd numbers from a given list:
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
3)d. WAP to accept values from a user and create a tuple:
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-4
a. Write a Python script to sort (ascending and descending)
dictionary by value.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
b. Write a Python script to concatenate the following
dictionaries to create a new one. Sample Dictionary :
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50,6:60}
Code:
Output:
c. Write a Python program to sum all the items in a
dictionary.
Code: Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-6
a. Write a program that makes use of built-in
mathematical functions.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
b. Write a program that makes use of built-in random
module functions.
Code:
Output:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
Practical-7
a. Write a recursive function to print the
factorial for a given number.
Code:
Output:
b. Write a python function to perform the basic
mathematical operations.
CODE:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
OUTPUT:
C.Write a function that reverses the user
defined value.
OUTPUT:
Roll no. :991
Name: Vishnu Vardhan Reddy
Class & Div: BSC.IT[C]
d. Write a function to check the input value is
Armstrong and also write the function for
Palindrome.