Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Section 2.3 describes lists and tuples in Python. Assuming the following assignment statements have been entered at the Python prompt: work_days = (Mon, Tues,
1. Section 2.3 describes lists and tuples in Python. Assuming the following assignment statements have been entered at the Python prompt: work_days = ("Mon", "Tues", "Wed", "Thu", "Fri") weekend = ("Sat", "Sun") week = work_days + weekend courses = [ ("CMPSC 8","MW"), ("CMPSC 8","TR"), ("PSTAT 120", "MW") ] exams = [[1.27, 2.24), (1.28, 2.25), 3.14) (2 pts each) What would be the result of entering the following in IDLE (Python interactive shell)? (Note: You are encouraged to check your answers at the Python prompt before turning in your work, but try this on paper first, just by reading the text and trying to predict what will happen. Then try typing in the results at the Python prompt. Change your answers if they were mistaken, but even more important, try to figure out why you were incorrect). Be very precise. For example, True is not the same in Python as true: upper vs. lower case matters; "UCSB" and ["UCSB") are not the same in Python-one is a string, and the other is a list of length one containing a single string. You will not get full credit for answers that are not precisely correct. Expression Result Expression Result len (week) len (work_days) len (courses) 3 len (exams) 3 Page 1 of 3 CS 8 (Winter 2020) Expression Result Expression len (exams[0]) Result 2 len (courses[1]) "CMPSC 8" in courses max (exams [1]) 2.25 False "Sun" in week True "CMPSC 8" in courses [2] False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started