Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

QUESTION #1 QUESTION #2 Write a program to input ten book titles and authors names then save them to a file named book.txt. For each

QUESTION #1image text in transcribed

QUESTION #2

Write a program to input ten book titles and authors names then save them to a file named book.txt.

For each book, the user will first input the title, then input the first name, then the last name of the author, all on separate lines. In addition to saving the books in the file, please output, using the print method. the information you've gathered from the user.

You should follow this format for your output:

Format:

TO KILL A MOCKINGBIRD Lee, Harper

All book titles should be in upper case and the authors name should be capitalized.

QUESTION #3

Write the code to find the average of the values stored in the text file temperatures.txt. All data in the file are float values.

Sample Output

The average temperature is: 58.36

Test Data

*average is pulled from temperatures.txt located in Google Drive* The average temperature is: 48.005

QUESTION #4

Use the file KnockKnock.txt (Down Below!)

The format of the file is all odd lines have the answers to Whos There The even numbers have the answers to _________ who? Question

Count the number of lines in the file, then generate a random knock-knock joke from the file.

Sample Run

(* the extra lines are there because each line ends in a and students will not know how to cut those off yet *)

Knock-Knock Who's there? Rabbit Rabbit who? Rabbit up carefully it's a present!

--

Nobel No bell, that's why I knocked! Boo I didnt mean to make you cry! Its just me! Will Will you let me in? Its freezing out here! Barbie Barbie Q Chicken! Figs Figs the doorbell, its broken! Kiwi Kiwi go to the store? Lettuce Let us in, were freezing! Olive Olive right next door to you. Turnip Turnip the volume, its quiet in here. Ice cream Ice cream if you dont let me in!

THIS IS A SIMPLE, HIGH SCHOOL COMPUTER SCIENCE COURSE IN PYTHON. PLEASE DON'T MAKE TOO COMPLICATED, THANK YOU!

7.2 Code Practice: Question 2 Write a program to generate passwords. The program should ask the user for a phrase and number, and then create the password based on our special algorithm. The algorithm to create the password is as follows: a. If the user's input word is less than 8 characters, output "Password not long enough." b. If the user's input word is greater than or equal to 8 characters, do the following: i. Replace e's with @ ii. Replace s or S with $ ili Replace t or T with iv. Capitalize the word and add the number to the end. Ever wonder why strong passwords are important? Read here for more information on Strong Passwords: https://support.google.com/accounts/answer/32040?hl en e Sample Run Enter your word: zebras Enter a number: 62 Password not long enough Enter your word: newyorkcity Enter a number: 892 Password: N@wyorkcity892

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions