Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON PROGRAMMING Lab 08 – Loop Structures Part #1: Multiplication Tables Desig

ID: 3811805 • Letter: P

Question

PYTHON PROGRAMMING Lab 08 – Loop Structures

Part #1: Multiplication Tables Design a PYTHON program that prompts the user to enter a number and then you will build a multiplication table of that size. For example, if they enter 10, you will generate a 10 x 10 table. Include a header row along the top and a header column along the side. You will need to use nested loops.

Part #2: File loops Write a PYTHON program to open a text file and convert all the vowels to periods. For example, if your file contains the line “Good morning” it would display it as “G..d m.rn.ng”. Use one of the techniques in section 8.3.3. to cycle through the file. Print the modified file output to the screen.

Explanation / Answer

#The answer for Part#2: File Loops:

f = open("file.txt",'r');
vow = ['a','A','e','E','i','I','o','O','u','U']
for l in f.readlines():
   l = l[0:-1]
   s = ""
   for a in l:
       if a in vow:
           s = s +'.'
       else:
           s = s+a
   print(s)