CLASS XI PROGRAMMING QUESTIONS
Write a python program to read the string and display “E” in place of all the occurrence
of “A”:
str="HONESTY IS THE BEST POLICY"
Write the python program to transfer the words having a length of exactly 4 character
in to the list L
For example:
['life', 'your', 'best']
s="Living a life you can be proud of Doing your best"
L=[]
w=s.split()
for i in w:
if len(i)==4:
L.append(i)
print(L)
1. Program to input a string and print the string with each word reversed. For e.g. if
the input string is “Raindrops and roses” , the output should be :”spordniaR dna
sesor”
2. Input a list of integers and modify the list such that all even numbers are converted
to zero and odd numbers are converted to 1. Print the modified list.
For E.g. if the input is [12,15,17,18,19] output should be [0, 1, 1, 0,1]
l=[12,15,17,18,19]
for i in range(len(l)):
if l[i]%2==0:
l[i]=0
else:
l[i]=1
print(l)
3. Write a python program which takes a dictionary Movie as an input and displays the
names in uppercase of those Movie whose name starts with a "T" or "G".
For example, Consider the following dictionary
Movie = {1:"Gladiator", 2:"Indiana Jones", 3:"Robinhood", 4:"Tommorrow never
Dies", 5:"Top Gun"}
The output should be:
Gladiator
Tommorrow never Dies
Top Gun
Movie = {1:"Gladiator", 2:"Indiana Jones", 3:"Robinhood", 4:"Tommorrow never
Dies", 5:"Top Gun"}
for k,v in Movie.items():
if v[0]=='G' or v[0]=='T':
print(v)