Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my assignment in Python In I If pizzas: I I'cheese', 'pepperoni', 'margherita', 'havailan', 'Italian sausage', 'green peppers and onions' I a) Using for

This is my assignment in Python image text in transcribed
image text in transcribed
image text in transcribed
In I If pizzas: I I'cheese', 'pepperoni', 'margherita', 'havailan', 'Italian sausage', 'green peppers and onions' I a) Using for statements and the method of lists called append, append in the list lengthe the length of each element in the pizz as list, and print the list lengths. InIIflengthe=(1)roukcooEBENRraiseNotImplementedError() Inf]t b) Using for statements, the string mothod called capitalize and the mothod of lists called appond, append in the listi.pizzas cop the capitalized version of each element in the pizzas list, and print the list pizzas cap. \[ \begin{array}{l} \text { In f It pizzan_cap }=11 \\ \text { YOUR CODE NerR. } \\ \text { raine Notipplenentedifror() } \\ \end{array} \] In I If c) Using for statements, the string method called find and the method of lists called append, appond in the list loe . e the index of the first 'e' that appoars in each element in the pizzas list, and print the list 1oo_.. Note: The if ind method will return - 1 if eiement is not found. Ini1+loge=[1-YOUHCODEHEREraiseNotimplenentedError() In I 1+ In this exercise, you will combine slicing with for statements. Given the following list: in I It sporte = ['Football', 'Volleyba11', 'Basketbal1', 'Basebal1', 'Handba11', '5oftbal1'] a) Write some code that extracts, from each word, all the letters except 'ball' at the end of each one. Savo the outplt in a list named mod_sports , and print it. in 1 i mod aports =11 - YOUR CODE IERE raise Notieplementedirror() a) Using for and if statements. Populate a list calod numbera 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 "Bumz. All the remaining numbers should remain as numbers. Note: You have to uso for statements and if statements togother. Tips: - Look into the 1 operator. - To check if something is equal to 0 , remember you need to use the - oomparison operator. Note: Atter you finish, you can use the print statement to chock your numbers list. 11. numbers =[1] i YOUH CODE HERE raise NotimplementedError() 1t

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

Students also viewed these Databases questions