am new to python, please share logic for below concept -


eg:

ece_student_list = [['section-1', [["sai",'science'], ["rama",'maths']]],                 ['section-2', [["seetha",'science'], ["ravana",'maths']]]] 

i have print student name , subject passing key section name.

for eg : if key 'section-1' first student should print "sai",'science' second student ,then should print "rama",'maths'

please share logic in python.

won't share code directly. have learn , experiment on own. although can tell can expect output.

you can create dictionary in python , add section-1, section-2 keys , list of students value each key.

your dictionary structure this:

{   'section-1' : [     {'sai':'science'},     {'rama':'math'}   ],   'section-2':[     {'sai':'science'},     {'rama':'math'}   ] } 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -