In: Computer Science
Python
What is the length of some_numbers?
What is the sum of the values in some_numbers?
How many courses is the student taking?
What is the student's birthdate?
How long is the course name of the second course in the student's list of courses?
some_numbers=[7,14,5,17,82]
student={"uin":123456789,
"name":"Josephina Student",
"birthdate": "01/01/2002",
"courses": ["CS111","BIOS100","ARST209","PHIL103"]}
course_catalog={
"ARST209": "The Art and Archaeology of the Ancient Near
East",
"PHIL103": "Introduction to Ethics",
"CS111":"Program Design I",
"CS141":"Program Design II",
"BIOS100": "Biology of Cells and Organisms"
}
some_numbers=[7,14,5,17,82]
student={"uin":123456789,
"name":"Josephina Student",
"birthdate": "01/01/2002",
"courses": ["CS111","BIOS100","ARST209","PHIL103"]}
course_catalog={
"ARST209": "The Art and Archaeology of the Ancient Near
East",
"PHIL103": "Introduction to Ethics",
"CS111":"Program Design I",
"CS141":"Program Design II",
"BIOS100": "Biology of Cells and Organisms"
}
some_numbers=[7,14,5,17,82] #create some_numbers list
student={"uin":123456789,
"name":"Josephina Student",
"birthdate": "01/01/2002",
"courses": ["CS111","BIOS100","ARST209","PHIL103"]} #create student
dictionary
course_catalog={
"ARST209": "The Art and Archaeology of the Ancient Near
East",
"PHIL103": "Introduction to Ethics",
"CS111":"Program Design I",
"CS141":"Program Design II",
"BIOS100": "Biology of Cells and Organisms"} #create course_catalog
dictionary
sub=[] #declaration of empty list sub
#What is the length of some_numbers?
print("length of some_numbers is = ",len(some_numbers)) #print
length of some_numbers
#What is the sum of the values in some_numbers?
print("sum of the values in some_numbers is = ",sum(some_numbers))
#addition of numbers in list some_numbers and print
#How many courses is the student taking?
print(len(student["courses"])," courses is the student taking")
#print length of course list
#What is the student's birthdate?
print("Student birthdate is = ",student["birthdate"]) #print the
value of birthdate in student dictionary
#How long is the course name of the second course in the
student's list of courses?
for index in student: #for loop in student dictionary
if index == 'courses': #check student dictionary key is equal to
courses
sub = student[index] # add list of courses in sub variable
second_course = sub[1] #get second course name in list
#print name of course and length of course name
print("course name of the second course in the student's list of
courses ",second_course," = ",course_catalog[second_course],"
length of course name is =
",len(course_catalog[second_course]))
==================================OUTPUT================================
==Please Upvote==