Question

5. (40pts) Answer the following 3 questions about the file outFile. with open(outFile . txt, **) as fh: aStr What does w

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

5.

"w" stands for the "write" in this context.

File

  1. xy
  2. xyxy

6.

5 times

When a number is even

N values are 0, 4, 56, 8, 56

7.

i values are 5, 4, 3, 2, 1, 0

OUTPUT

-4:-3:8:5:-2:9:
[9, -2, 5, 8, -3, -4]

--------------------------------------
Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
5. (40pts) Answer the following 3 questions about the file outFile. with open("outFile . txt", "**)...
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
  • Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline()...

    Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _____________________ print("Error") What should be placed in the blank so that the program will print Error instead of crashing if an exception occurs while opening or reading from the file? Group of answer choices a- except RuntimeError : b- except EnvironmentError : c- except IOError : d- except IndexError : 2) Consider the following code segment: line = "hello world!" parts = line.split()...

  • 40pts) Given the following code segment. mSwer= input("Enter age: ") ile answer != 'q' : try:...

    40pts) Given the following code segment. mSwer= input("Enter age: ") ile answer != 'q' : try: print(int(answer) ) answer input ( " Enter age: ") except Value E rror : print ("Invalid answer 'q' age") Show what is printed if the user enters the following values at the prompt, one at a time. Print output User input 20 17 2a => 29 q 9. The following main function works with a class called Student that you will write. def main()...

  • Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and...

    Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and allow you to read data from it?                (a)      File file = new File("MyFile.txt");           (b)      FileWriter inputFile = new FileWriter();           (c)       File file = new File("MyFile.txt");                      FileReader inputFile = new FileReader(file);           (d)      FileWriter inputFile = new FileWriter("MyFile.txt"); (2)     How many times will the following do - while loop be executed?                      int x = 11;             do {             x...

  • 1. Assume that setA is a set that contains the following elements: 15, 1, 3, 8,...

    1. Assume that setA is a set that contains the following elements: 15, 1, 3, 8, 17, and 21. Assume that sets is a set that contains the following elements: 4, 8, 16, 2, 3, and 21. What are the values in the following sets? a. SetA^ setB b.setA - setB c.setA.union(setB) d.setA & setB 2. Construct truth table for the following Boolean expressions: (A or B) and not B. 2 3. The Python file, named apple.py contains the following...

  • I need python help .. I need to know if a user were to input 3...

    I need python help .. I need to know if a user were to input 3 commands to a program and run it such as specify: Usage: ./filemaker INPUTCOMMANDFILE OUTPUTFILE RECORDCOUNT (./filemaker is the program)( (INPUTCOOMANDFUILE= a text file that contains key words that need to be searched through then decided what to do ) (RECORDCOUNT= number) Given an input file that contains the following: That specifies the text, then the output, and the number of times to be repeated...

  • There is a file called mat2.txt in our files area under the Assignments folder. Download it...

    There is a file called mat2.txt in our files area under the Assignments folder. Download it and save it in the same folder where this Matlab file (HW08_02.m) is saved. It may be worth opening that text file to see how it is set out. Note well, however, that the file might have a different number of lines and different number of numbers on each line. Write a Matlab program that does the following: Prompt the user for an input...

  • The following code reads in 4 comma separated values from a .txt file of the format:...

    The following code reads in 4 comma separated values from a .txt file of the format: Kayne,West,1112223333,0. getline(inputFile, firstName, ','); getline(inputFile, lastName, ','); getline(inputFile, phoneNumber, ','); getline(inputFile, phonetype, '\n'); How could I write a while loop that reads through a .txt file like above (without using eof!) but with an unspecified number of entries?

  • 1) Which of the following is NOT true about a Python variable? a) A Python variable...

    1) Which of the following is NOT true about a Python variable? a) A Python variable must have a value b) A Python variable can be deleted c) The lifetime of a Python variable is the whole duration of a program execution.   d) A Python variable can have the value None.        2) Given the code segment:        What is the result of executing the code segment? a) Syntax error b) Runtime error c) No error      d) Logic error 3) What...

  • I am trying to create tkinter GUI for guess a number game.I am not able to...

    I am trying to create tkinter GUI for guess a number game.I am not able to complete it .Could someone guide me to complete.I am so confused about using tkinter in while loop . Below code is not working correctly .Could someone please help with this ? def get_binary_digits(dividend): binary_digits = [] while dividend != 0: quot = dividend // 2 remainder = dividend % 2 binary_digits.append(remainder) dividend = quot # The quotient becomes the new dividend. binary_digits.reverse() return binary_digits...

  • Python What do the following loops print? Work out the answer by tracing the code, not...

    Python What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. s = 2 for n in range (1, 6): s = s + n print(s) b. s = 1 for n in range (1, 11): n = n + 2 s = s + n print(s) c. S = 1 for in range (1, 6) s = s + n n = n + 1 print(s, n) Rewrite the...

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