Question
THIS IS A SIMPLE HIGH SCHOOL COMPUTER SCIENCE COURSE IN PYTHON . PLEASE KEEP IT SIMPLE , THANK YOU! QUESTION #1 Write a program to
THIS IS A SIMPLE HIGH SCHOOL COMPUTER SCIENCE COURSE IN PYTHON. PLEASE KEEP IT SIMPLE, THANK YOU!
QUESTION #1
Write a program to find the average of the numbers stored in NewYorkTemps.txt (Down Below!). Be sure your output uses floating point numbers (i.e. numbers with decimals).
56.0 57.5 58.4 70.3 51.2 68.5 93.2 57.8 55.0 45.3 68.7 42.1 20.0 21.1 25.5 26.6 30.3 33.2 31.6 32.8 54.5 50.2 45.5 36.6 24.2
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 seperate 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!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started