Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python 0 pts) Go to http://cs.ucsb.edu/-zmatni/cs8w19/itsybitsy.txt. Copy the text and save it on your computer on a file using your favorite text editor (example,

In python image text in transcribed
0 pts) Go to http://cs.ucsb.edu/-zmatni/cs8w19/itsybitsy.txt. Copy the text and save it on your computer on a file using your favorite text editor (example, Notepad or Notepad++ on Windows, or Sublime or TextEdit on MacOS, or vim or emacs on Linux). Be careful to save it as a simple TEXT file only (that is, NOT as a Rich Text File or Microsoft Word File, etc...). a. b. Run the following Python program that reads the file in part (a) and then explain what it does and why. Specifically, explain: i. Why do the print statements inside the for-loops have the end"option? ii. What differences do the strings f1 and f2 seem to do? ii. How are each of the 3 runs in the program different from one another? (write your answers on the next blank page) f1-0:1 InFile-open ('itsybitsy.txt, 'r, encoding- 'utf-8) Lo 1nFile, readlines() print("*RUN 1***") for line in LOL: print(line, end- ") print("RUN 2***") for line in LoL if "and" in line: line-1ine.replace("and "AND print(f1.format (line), end-) print("RUN 3**) for line in LOL if "spider" in line: line line . replace("spider", "Gaucho") = print(f2.format (line), end-') InFile.close()

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

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago