Ass-Strings and Dictionaries
Ass-Strings and Dictionaries
1
6 What will be the output of following program:
s='Hello'
for i in s:
print(i,end='#')
a='hello'
b='virat'
for i in range(len(a)):
print(a[i],b[i])
2
15 What will be the output of following
program: str = "my name is kunfu
pandya";
print (str.capitalize())
3
20 What will be the output of following
program: s='Mahender, Singh, Dhoni'
s1=s.sp
lit() for
i in s1:
print(i)
4
25 What will be the output of following program:
my_string = 'PYTHON4CSIP'
for i in range(len(my_string)):
print (my_string)
my_string = '#'
5
6
7
DICTIONARIES
1. What will be the output of following code
a={1:"A",2:"B",3:"C"}
for i in a:
print(i,end=" ")
37. Write a Python program to iterate over dictionaries using for loops
d = {"blue" : 1, "green" : 2, "yellow" : 3}
for key,value in d.item:
print(key, value)
13