Question: QUESTION IS IN PYTHON PLEASE ANSWER IN PYTHON Question 3: 10 points The following program is slightly different from the program in Question 2 1
QUESTION IS IN PYTHON PLEASE ANSWER IN PYTHON
Question 3: 10 points The following program is slightly different from the program in Question 2 1 | sportsList = open ('sports. txt') 2for index in range(1,11): sp = sportsList . readline () print (str (index)+". " ,sp.rstrip ()) (a) (2 points) Compare the output from this program to the previous program. What is the difference? (b) (2 points) What code caused the difference in the output? (c) (2 points) Does the rstrip() function contain any arguments? (d) (2 points) How does it know what string to act upon? (e) (2 points) lstrip) is a similar function. What do you think it does? Question 4: 6 points The following program is slightly different from the program in Question 3 1 sportsList - open ( 'sports.txt') 2 for index in range (1,11): rtsList.readline () sp - spo if len (sp) print (sp.rstrip )) (a) (2 points) How is the output different from Question 3 (b) (2 points) Two functions use what is known as dot (.) notation. What are the two functions? (c) (2 points) Examine the output and explain what the len() function does
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
