Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my assignment in Python. For Exercise 1, please clarify each answer. Usts, slicing and for statements. Given the list named pizzan In {11+

This is my assignment in Python. For Exercise 1, please clarify each answer.
image text in transcribed
image text in transcribed
Usts, slicing and for statements. Given the list named pizzan In {11+ pitzan - I'cheeae', 'pepperoni", "marqherita', 'havailan', 'itallan nausage", 'qreen peppera and oniona' I. a) Using for statements and the method of lists called append, append in the lst lengths the longth of each olement in the pizzas list, and print the list lengths. \[ \begin{array}{l} \text { In }[12] \text { pizzas cape } 11 \\ \text { print(pizzas_eap) } \\ \end{array} \] [] b) Using for statements, the string method called capitalize and the mothod of lists called append, append in the list pizzas cap the onpitalized version of each element in the pizzas sist, and print the list pizzan_eap. \[ \begin{array}{l} \text { In (13): } \begin{array}{l} \text { pizzas cape }[1 \\ \text { for } x \text { in pizzasi } \\ x=x \text {.eapatilise }() \\ \text { pizzan_eap.append }(x) \\ \text { print (pizeas_oap) } \end{array} \end{array} \] Attributezrror /tap/ipykernel_27/3590121139, py in Tracebaek (noat recent eall last) \[ \begin{array}{l} 1 \text { pizzas_eap=| } \\ \text { for } x \text { In pizzasi } \\ x \text { = X.capatilize }(\} \\ \text { piemas eap: append }(x) \\ \end{array} \] Attributenrrori "atr' object has no attribute 'capatilise" ln[14 c) Using for statements, the string method called find and the mothod of lists caled append, append in the lst loc e the index of the firat "e: that appears in each element in the plazas list, and print the list loo_e : Note: The f ind method will rotum - 1 if element is not found. In11loe0=11trOURCOOEHRRE:raiseNotinplementederror() a) Using for and if statements. Populate a list called that will go from 0 up to 100 where, if the number is divisible by 3 and 5 , you replace it by the word "FizzBuzz"; if the number : is divisible by 3 , you replace it by "Fizz"; and if the number is divisible by 5, you replace it by "Buzz". All the remaining numbers should remain as numbers. Note: You have to use statements and it statements togethec. Tips: - Look into the s operator. - To check if something is equal to 0 , remember you need to use the comparison operator. Note: After you finish, you can use the statement to check your list. 1. numbers =[1 * YOUR CODE HERE raise NotimplementedError()

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

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions