Answered step by step
Verified Expert Solution
Link Copied!

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,

image text in transcribed
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 (work_days) len (courses) len (week) len (exams) 3 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 (11) 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Identify the alkanes corresponding to each of the drawings shown.

Answered: 1 week ago

Question

2. Use a point system or model papers when grading essays.

Answered: 1 week ago