Question

First create this program and save to a file called timetable.txt time table.txt #We want the tables from 3 to 15 7 that Crea

1.create a file that has this times table but for the multiple of 3 and until 3x15

2.inset a poem at the end of the time table file

3.complete it in a single program

Python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

# create the timetable.txt file
f = open("timetable.txt", "w")
# write the tables to the file timetable.txt
for i in range(1, 16):
f.write("%2d times 3 is %d\n" % (i, (3 * i)))
# mark the end of the table
f.write("-----------------\n")
# open the original.txt file to read
f1 = open("original.txt", "r")
# write the contents of original.txt to the file timetable.txt
for line in f1.readlines():
f.write("%s" % line)
# close the files
f1.close()
f.close()

Sample Output

File Edit Format Run Options Window Help # create the timetable. txt file f = open(timetable. txt, # write the tables to th

original.txt - Notepad File Edit Format View Help This is my Poem.

timetable txt - Notepad File Edit Format View Help 1 times 3 is 3 2 times 3 is 6 3 times 3 is 9 4 times 3 is 12 5 times 3 is

Note - Please indent the code as given in the screenshot to avoid indentation error.

Add a comment
Know the answer?
Add Answer to:
1.create a file that has this times table but for the multiple of 3 and until...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • a. Provide me with your code file, output file and the text file. 1. Create a...

    a. Provide me with your code file, output file and the text file. 1. Create a file with a series of integers. Save it as numbers. txt. Write a program that reads all the numbers and calculates their sum . 2. Create a file having different integers than the first one. Save it as numbers1. txt . Write a program that reads all the number and calculates their average. Important: The two files that you are creating will contain different...

  • (Python 3) Write a program that reads the contents of a text file. The program should...

    (Python 3) Write a program that reads the contents of a text file. The program should then create a dictionary in which the keys are individual words found in the file and the values are the number of times each word appears and a list that contains the line numbers in the file where the word (the key) is found. Then the program will create another text file. The file should contain an alphabetical listing of the words that are...

  • Java Programming Part 1 File encryption is the science of writing the contents of a file...

    Java Programming Part 1 File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will be a version of the first file, but written in a secret code. Although there are complex encryption techniques, you should come up with a...

  • Completion is a screenshot of the batch file showing all of the steps to create the file system s...

    Completion is a screenshot of the batch file showing all of the steps to create the file system shown below. Instructions Create a batch file clifilesystem.cmd using Notepad which performs the following steps to create the file system shown below. Also use a proper comment for each step before the command. Proof your work. Finally submit the clifilesystem.cmd file in Blackboard Figure 1. The clijfilesystem.cmd file system Work from Desktop unless using an absolute path Desktop NOS110 OS Labs Homework...

  • Python Basic Lists, File IO, Exception Handling 1. Call createTable() to: Read in the data from...

    Python Basic Lists, File IO, Exception Handling 1. Call createTable() to: Read in the data from each of the input files (in order from scores1.txt to scores5.txt) and store the data in table. The table is a list of lists, where the scores of each input file is a column of data of the table. By the end of the function, the table should have 5 columns of numbers, each column is from one input file. Here is the first...

  • create an input file with the numbers shown below and then create an output file with...

    create an input file with the numbers shown below and then create an output file with java ? Polish Peasant Multiplication About It takes two numbers, side by side. The left number is multiplied by 2 every time the right number is divided by 2. 50                    30 100                  15 200                  7 400                  3 800                  1 Take out the numbers in the left side that corresponds to an even number to the right side, in this case 30 is the only even number available.                          30...

  • This isa Java program Create file, file 1, with the following values: 3 4 35 20...

    This isa Java program Create file, file 1, with the following values: 3 4 35 20 -43 17 -10 6 7 -2 13 1 2 3 Write a program in Java to do the following: Open "file 1" and read the first two values, rand c, which are supposed to indicate the dimensions of the two-dimensional array whose values are given in the file after the values of r and c. Create a two-dimensional array of size r times c....

  • Must be done in python and using linux mint Write a program to create a text...

    Must be done in python and using linux mint Write a program to create a text file which contains a sequence of test scores. Each score will be between 0 and 100 inclusive. There will be one value per line, with no additional text in the file. Stop adding information to the file when the user enters -1 The program will first ask for a file name and then the scores. Use a sentinel of -1 to indicate the user...

  • (In Linux) 1. Create a file to write to from your script and save it as...

    (In Linux) 1. Create a file to write to from your script and save it as “.txt”. 2. Write the following information to the file that you created in Step 1: Today's date Your full name Your student ID The name of your course What directory you are in File permissions of the file that you created that allow everyone to read, write, and execute The long list of files in your current directory, providing all items and their process...

  • Homework 1- Merge Files: 1. Design a class named MergeFiles 1 Three file names are passed...

    Homework 1- Merge Files: 1. Design a class named MergeFiles 1 Three file names are passed as command-line arguments to MergeFiles as follows: java MergeFiles filel file2 mergedFile II. MergeFiles reads names stored in files file and file2 III. Merges the two list of names into a single list IV. Sorts that single list V. Ignores repetitions VI. Writes the sorted, free-of-repetitions list to a new file named mergedFile.txt VII. The names in all three files are stored as one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT