Question: python progrmming task 3 and 4 Task 3: Practice How to Use String Object a) What is wrong with the following code? Explain verbally. el

 python progrmming task 3 and 4 Task 3: Practice How to

python progrmming

task 3 and 4

Task 3: Practice How to Use String Object a) What is wrong with the following code? Explain verbally. el sl"Canada" s1 [2] = 'P'+' Computing Science 120.s10 Page 3 of 5e Lab #B2- b) What will the following code display? Explain verbally. s1 "Hawaii is a paradise" print (sl [2:8]) c) Write code using the in operator that determines whether 'p' is in s1.. Task 4: Practice How to Use String Object a) Assume the following statement appears in a program: s1 Practice How to Use String Object' Write a statement that splits the string, creating the following listO I'Practice', 'How', 'to', 'Use', 'string', 'object']- b) Assume reply references a string. The following if statement determines whether reply is equal to Y or 'y reply input ("Y or y to continue: "). if reply"Y" and reply"y": else:+ print ("Y-- has been selected. ") print ("y has been chosen. m) print (". continue running this program) Rewrite this statement so it only makes one comparison and does not use the or operator. (Hint: use either the upper or lower methods.). c) Write a loop that asks the user "Do you want to repeat the program or quit? R/O". The loop should repeat until the user has entered an R or Q (either uppercase or lowercase)

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!