1. Write a program in Python named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Sample Output.SAMPLE OUTPUTEnter first name of friend or Enter to quit DennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quit PennyEnter age (integer) of this friend 28Enter first name of friend or Enter to quit LennyEnter age (integer) of this friend 20Enter first name of friend or Enter to quit JennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quit File was created

Question
Asked Oct 10, 2019
37 views

1. Write a program in Python named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Sample Output.
SAMPLE OUTPUT

Enter first name of friend or Enter to quit Denny
Enter age (integer) of this friend 24
Enter first name of friend or Enter to quit Penny
Enter age (integer) of this friend 28
Enter first name of friend or Enter to quit Lenny
Enter age (integer) of this friend 20
Enter first name of friend or Enter to quit Jenny
Enter age (integer) of this friend 24
Enter first name of friend or Enter to quit
File was created

check_circle

Expert Answer

Step 1
  • This python program asks user to enter First name and Age of a number of friends. 
  • This p...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Python

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Hello, I am using the Intro to Java programmming and data structures by Y. Daniel Liang. Our profess...

A: A java program to check the user’s input is a factor of random number generated is given below;Progr...

question_answer

Q: I have a bit of code that is intended to read a file ("students.txt") and calculate the average, hig...

A: Description:The following program is to print the highest, lowest, and average of test scores by rea...

question_answer

Q: When using the arc implementation to convert a super set entity into a relation, what if the entityd...

A: Arc implementation is considered as supertypes/subtypes data modelling. Like for an Event, it can be...

question_answer

Q: In a file called Stars.java, write a program that: Asks the user to enter a positive integer N >...

A: // This JAVA program takes an input N>0//It prints a star pattern. 

question_answer

Q: Write a Java program that prompts the user to enter an integer and reports whether the integer is a ...

A: Create a class with name Check_pal, and initialize a global variable number of class methods.Create ...

question_answer

Q: Create a method multiply(), that receives the 2D array you created in 2. as aninput, multiplies all ...

A: Click to see the answer

question_answer

Q: In C++ Create an array of random 10 random numbers. Use the "range-based for loop" (sometimes called...

A: Program designuse a reference type loop variable in the range-based for loop to assign elements to a...

question_answer

Q: How do I use a break line tag when I am creating a web page? W3PTEF

A: Break line tag:The “<br/>” is the tag for the break line.Break line tag can end the line curre...

question_answer

Q: compare and contrast symmetric encryption with public-key encryption, including the strengths and we...

A: DefinitionEncryptionIn cryptography, encryption is basically a concept related to keys. It is a tech...