Question: NEED HELP ON THE WHOLE PROGRAM PLEASE! THANK YOU. Write a Python program that (1) First create an empty list, and use a while loop

NEED HELP ON THE WHOLE PROGRAM PLEASE! THANK YOU.

NEED HELP ON THE WHOLE PROGRAM PLEASE! THANK YOU. Write a Python

Write a Python program that (1) First create an empty list, and use a while loop to add consecutive numbers '137' to '173' to the list using the append method (augmented assignment operator "+=" will be used to iterate over these numbers). Print the generated list. (2) Use the index method to get the index of numbers '145' and 161, print the two indexes (3) Use the slicing expression to extract a slice of the list from the number 145' to the number '161' (You need to use the results obtained from step (2)). Print the extracted slice (4) Use the in operator to detect if 155' is in the slice, print the result (true/false). The generated list is [137, 138, 139, 140, 141, 142, 143, 144, 14 5, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 15 8, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 17 1, 172, 173] 1st index is 8 2nd index is 24 The extracted slice is [145, 146, 147, 148, 149, 150, 151, 152, 1 53, 154, 155, 156, 157, 158, 159, 160, 161] Whether the slice contains 155 True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!