ClassXI-Practical File Term 2
ClassXI-Practical File Term 2
Output:
3. Write a program that asks a user for a username and a pcode. Make sure that
pcode does not contain username and matches ‘Trident111’
4. Program that reads a line and prints its statistics like:
Number of uppercase letters:
Number of alphabets:
Number of symbols:
Number of lowercase letters:
Number of digits:
5. Write a program that inputs individual words of your school motto and joins
them to make a string. It should also input day, month and year of your school’s
foundation date and print the complete date.
Output:
6. Extract two list slices out of a given list of members. Display and print the sum
of elements of first list-slice which contains every other element of the list
between indexes 5 to 15.Program should also display the average of elements in
second list slice that contains every fourth element of the list. The given list
contains numbers from 1 to 20.
7. Write a program to create a copy of a list. In the list’s copy, add 10 to its
first and last elements. Then display the lists.
L1 = [17, 24, 15, 30, 34, 27]
L2 = L1.copy()
print(“Original List: ”, L1)
print(“Created copy of the list:” , L2)
L2[0] +=10
L2[-1] +=10
print(“Copy of the list after changes:” , L2)
print(“Original list:” L1)
Output
Original list : [17, 24, 15, 30, 34, 27]
Created copy of the list : [17, 24, 15, 30, 34, 27]
Copy of the list after changes : [27, 24, 15, 30, 34, 37]
Original list : [17, 24, 15, 30, 34]
11. Write a program to input a tuple and check if it contains the all elements
as same.
12. Write a python program that creates a tuple storing first 9 terms of
Fibonacci series.
lst = [0,1]
a=0
b=1
c=0
for i in range(7):
c=a+b
a=b
b=c
lst.append(c)
tup = tuple(lst)
print("9 terms of Fibonacci series are:", tup)
Output
Output