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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -