Professional Documents
Culture Documents
Assignment 1706007105
Assignment 1706007105
1X14=14
2X14=28
3X14=42
4X14=56
5X14=70
6X14=84
7X14=98
8X14=112
9X14=126
10X14=140
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:23 PG NO:
Program:
a=int(input("Which table you want?"))
for i in range(1,11):
print(i, "x", a, "=", i*a)
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading Program
OUTPUT:
FACTORIAL CALCULATOR
1x2x3x……..x8=40320
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:24 PG NO:
Write a python program to find the factorial of any given
number.(using loop)
Program:
print("\t\tFACTORIAL CALCULATOR")
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT :
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:25 PG NO:
Write a Python program to accept a name
and display only the initials.
Program:
a=input("Type any string :")
b=a.split()
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT :
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:26 PG NO:
Write a Python program to find the number of
words present in the given sentence.
Program:
a=input("Type any sentence :")
b=a.split()
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT :
Type any string : TFA WILL PLAY FOOTBALL MATCH AGAINST ATK CLUB.
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:27 PG NO:
Write a Python program to accept a sentence
and display the longest word present in it along
with its length.
Program:
a=input("Type any string :")
b=a.split()
max=""
for i in b:
if len(i)>len(max):
max=i
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT :
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:28 PG NO:
Write a Python program to remove all the
duplicates present in the given string.
Program:
b=""
for i in a:
if i not in b:
b=b + i
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT :
Enter the number of datas to be stored in the list ::: 6
Enter 6 numbers:
50
-3
-57
78
90
67
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:29 PG NO:
Write a program to read a list of n integers. Also find the maximum,
minimum & mean of numeric values stored in a list.
Program:
n= int(input("Enter the number of datas to be stored in the list:"))
L=[]
print("Enter", n , "datas:")
for i in range(n):
a=int(input())
L.append(a)
NOTE:
● Question and Program should be written in the right-hand side using BLUE PEN.
● Underline the heading
OUTPUT:
SEGREGATION PROGRAM
Enter the number of datas to be stored in the list ::: 6
Enter 6 numbers:
50
-3
-57
78
90
67
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:30 PG NO:
Write a program to segregate positive and negative
numbers of a list in two different lists.
Program:
print("SEGREGATION PROGRAM")
n= int(input("Enter the number of datas to be stored in the list:"))
L=[]
print("Enter", n , "datas:")
for i in range(n):
a=int(input())
L.append(a)
P=[]
N=[]
for i in L:
if i>=0:
P.append(i)
else:
N.append(i)
print("Datas:", L)
print("Positive Datas are:", P)
print("Negative Datas are:", N)
OUTPUT :
DUPLICATE DATA REMOVER
Enter the number of datas to be stored in the list::: 6
Enter 6 numbers:
50
10
20
10
50
50
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:31 PG NO:
Write a Python program to remove duplicate datas from a list
containing n integers.
Program:
print("SEGREGATION PROGRAM")
n= int(input("Enter the number of datas to be stored in the list:"))
L=[]
print("Enter", n , "datas:")
for i in range(n):
a=int(input())
L.append(a)
L1=[]
for i in L:
if i not in L1:
L1.append(i)
print("Original List:", L)
L=L1
print("Modified List is:", L)
OUTPUT:
Enter the number of datas to be stored in the list ::: 6
Enter 6 numbers:
50
60
70
80
60
100
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:32 PG NO:
Write a program to search whether the given element is present in the
list or not using LINEAR SEARCH.
Program:
print("SEGREGATION PROGRAM")
n= int(input("Enter the number of datas to be stored in the list:"))
L=[]
print("Enter", n , "datas:")
for i in range(n):
a=int(input())
L.append(a)
if flag==0:
print("Search Data is not present in the List")
OUTPUT:
Enter the number of datas to be stored in the tuple::: 6
Enter 6 numbers:
10
20
25
28
30
40
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:33 PG NO:
Write a program to segregate elements present in odd and even
locations of a tuple to two different tuples.
Program:
n= int(input("Enter the number of datas to be stored in the tuple:"))
T=()
print("Enter", n , "datas:")
for i in range(n):
a=int(input())
T=T+ (a,)
O=()
E=()
for i in range(0, len(T)):
if i%2!=0:
O=O + (T[i], )
else:
E=E + (T[i], )
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:34 PG NO:
Write a Python Program to access the phone number of a particular person from the
dictionary containing ‘n’ contacts.
Program:
n= int(input("Enter the number of contacts to be stored in the dictionary:"))
CONTACTS={}
for i in range(n):
key=input("Enter person name:")
value=int(input("Enter phone number:"))
CONTACTS.update( {key:value} )
Dictionary contains: {101: 'Steve', 100: 'Hasan', 99: 'Akira', 88: 'Ibhrahim'}
Employee-ID Employee-Name
88 Ibhrahim
99 Akira
100 Hasan
101 Steve
NOTE: OUTPUT DESIGN should be written in the left-hand side using PENCIL.
EXNO:35 PG NO:
Write a Python Program to display all employees’ information in
ascending order based upon their ID from the dictionary containing ID
and name for ‘n’ employees.
Program:
n= int(input("Enter the number of employees:"))
EMPLOYEE={}
for i in range(n):
ID=int(input("Enter employee - ID:"))
Name=(input("Enter phone number:"))
EMPLOYEE.update( {ID:Name} )
a=sorted(EMPLOYEE)
print("Employee-ID\t\tEmployee-Name")
for i in a:
print(i, "\t\t", EMPLOYEE[i])