Professional Documents
Culture Documents
Roll no.- 11
OUTPUT:
# OPERATORS
QUES:What will be the output produced by the
following code ?
an.rwer.
OUTPUT:
2.3 2.0
16.0
10.0
1.2
# WORKING WITH MATH MODULE OF PYTHON
Output:
Output:
random numbers between 45..95:
83.62339196051849
nearest higher integer: 84
CH-9-FLOW OF CONTROL
Output:
enter an integer:8
8 is even number
Output:
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
CH-10-STRING MANUPULATION
# TRAVERSING A STRING
Output:
B -H -A -V -A -Y - -R -U -S -T -A -G -I -
# STRING OPERATORS
QUES:Write a program that asks a user for a
user name and a code.Ensure that the user
dosen’t use their username as a part of their
code.
an.rwer.
Output:
enter user name:kobe
enter a code:mykobeworld
your code should not contain user name.
thank you
# STRING SLICES
QUES:Write a program to input two string1 is
contained in string2 then create a third string
with first four character of string2’added with
word ‘Restore’.
an.rwer.
Output:
enter string 1:rin
enter string 2:shagrin
original string : rin shagrin
final string : rin shagrestore
Output:
enter line:jingle bells jingle bells jingle all
the way
enter substring:jingle
No. of occurrences of jingle : 3
CH-11-LIST MANIPULATION
#LIST OPERATIONS
QUES: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.
an.rwer.
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, 27]
Output:
sorted: [15, 17, 24, 30]
reverse: [30, 24, 17, 15]
#NESTED LOOP
Output:
CH-12-TUPLES
#TUPLE OPERATORS
QUES:Write a program to input a tuple and
create two new tuples from it,one containing
its every 3rd elements in reverse order,
starting from the last elements another
containing every alternate elements lying
between 3rd to 9th elements.
an.rwer.
Output:
Enter input for tuples:1,2,3,4,5,6,7,8,9,10,11
Two created tuples are:
tuple 1 : (11, 8, 5, 2)
tuple 2 : (3, 5, 7)
#NESTED TUPLES
QUES:A student’s roll number,name and marks in
5 subjects are available in the form of a tuple
as shown here:student(11,’Ria’(67,77,78,82,80))
Write a program to print the minimum and
maximum marks along with total marks obtained
by the student.
an.rwer.
Output:
Minimum marks obtained : 67
Maximin marks obtained : 82
Total marks obtained : 384
CH-13-DICTIONARIES
Output:
Given dictionary is : {1: 111, 2: 222, 3: 333, 4: 444}
Maximum and Minimum keys: 4 1
Maximum and Minimum values 444 111
Sum of dictionary's keys : 10
Sum of dictionary's values: 1110