Answer to Question #296138 in Python for Sundar

Question #296138

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.


1
Expert's answer
2022-02-10T15:24:37-0500
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])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS