Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1 : Suppose we have the following list: x = [ 5 , 1 0 , 3 , 2 , 8 , 0 ]

Exercise 1: Suppose we have the following list:
x =[5,10,3,2,8,0]
explis what would be the "start" when it is not specified in slicing and the
stride is negative. Why does it make sense?
Exercise 2: Suppose we have the following list:
=[1,2,3,4]
Which of the following creates a list with elements being the corresponding elements of "a" added to 1?
* a +1
* a +[1,1,1,1]
*[i+1 for i in al
*[a +1]
Exercise 3: Suppose we have the following dictionary:
d ={1: "good", 2: "morning", 3: "john"'}
a) Write a piece of code that loops through the values of this dictionary and makes the first letter in each word upper case (hint: check out string. title() method).
The output should look like this:
value = Good
value = Morning
value = John
b) use the iterable unpacking operator to create the following set:
{' good'
, 'john',
'morning'}

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions