While taking a viva class teacher decides to take the viva of 2 roll numbers at a time. For
this he calls out the roll numbers from the roll number list as: one roll no. from 1st nth roll number and 2nd roll number from the nth last roll number. For example if the numbers are
roll-num=[31,25,4,22,5,43,11,30,6,17] and n=3 the one roll number for viva is 4 and 2nd roll number for viva is 30. Give fixed input.
list =[31,25,4,22,5,43,11,30,6,17]
roll_num= list
n=3
# To print the third index from the list is n-1
print("one roll number for viva is:",roll_num[2])
print( "2nd roll number for viva is: ", roll_num[-3])
Comments
Leave a comment