Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 9PE
Program Plan Intro
Print the date of Easter
Program plan:
- Define the function “easter()”,
- Check whether the year lies between “1982” and “2018”,
- If it is true, calculate the value of “a”, “b”, “c”, “d”, and “e” using the formula.
- Check whether the sum of "d” and “e” is greater than “9”,
- If it is true, print the date of Easter on April.
- Otherwise, print the date of Easter on March.
- Otherwise, print the message as “Year is out of range”.
- Check whether the year lies between “1982” and “2018”,
- Define the function “main()”,
- Get the year from the user.
- Call the function “easter()”.
- Call the function “main()”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Teachers in most school districts are paid on a schedule that provides a salary based on their number of years of teaching experience.
For example, a beginning teacher in the Lexington School District might be paid $30,000 the first year. For each year of experience after this first year, up to 10 years, the teacher receives a 2% increase over the preceding value.
Write a program that displays a salary schedule, in tabular format, for teachers in a school district. The inputs are:
1. Starting salary
2. Annual percentage increase
3. Number of years for which to print the schedule
Each row in the schedule should contain the year number and the salary for that year
An example of the program input and output is shown below:
Enter the starting salary: $30000
Enter the annual % increase: 2
Enter the number of years: 10
Year Salary
1 30000.00
2 30600.00
3 31212.00
4 31836.24
5 32472.96
6 33122.42
7 33784.87
8…
f.
A laborant in a laboratory does a number of antigen tests in one day. Write a program that
simulates the number of antigen tests done in a day in a laboratory, displays the number of
positives and negatives, and calculates the % of positives in one day. Your program needs
to first generate a random number that will show the number of tests done in a day. One
laboratory in a day cannot do more than 100 tests and less than 1 (they do at least one).
Then for each of the tests, your program needs to generate a random number to show
whether they are positive or negative. In order to write this program, you need to have the
following three functions used by the main function:
test result (void): This function generates a test result. It should randomly
return either one or zero. 1 means positive test result and 0 means negative test result.
float positive percentage (int,int) : This function takes the total number of
positives and the total number of tests and returns the % of positives.…
Use python
The speeding ticket fine policy in Wonderland-Bemidji is $50 plus $5 for each mph over the limit,
plus an additional penalty of $200 for any speeds over 90mph. Write a program that accepts a
speed limit (<= 90) and a clocked speed, and either outputs a message indicating the speed
was legal, or prints the amount of the fine if the speed is illegal.
Chapter 7 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
Ch. 7 - Prob. 1TFCh. 7 - Prob. 2TFCh. 7 - Prob. 3TFCh. 7 - Prob. 4TFCh. 7 - Prob. 5TFCh. 7 - Prob. 6TFCh. 7 - Prob. 7TFCh. 7 - Prob. 8TFCh. 7 - Prob. 9TFCh. 7 - Prob. 10TF
Ch. 7 - Prob. 1MCCh. 7 - Prob. 2MCCh. 7 - Prob. 3MCCh. 7 - Prob. 4MCCh. 7 - Prob. 5MCCh. 7 - Prob. 6MCCh. 7 - Prob. 7MCCh. 7 - Prob. 8MCCh. 7 - Prob. 9MCCh. 7 - Prob. 10MCCh. 7 - Prob. 1DCh. 7 - Prob. 2DCh. 7 - Prob. 3DCh. 7 - Prob. 1PECh. 7 - Prob. 2PECh. 7 - Prob. 3PECh. 7 - Prob. 4PECh. 7 - Prob. 5PECh. 7 - Prob. 6PECh. 7 - Prob. 7PECh. 7 - Prob. 8PECh. 7 - Prob. 9PECh. 7 - Prob. 10PECh. 7 - Prob. 11PECh. 7 - Prob. 12PECh. 7 - Prob. 13PECh. 7 - Prob. 14PECh. 7 - Prob. 15PECh. 7 - Prob. 16PECh. 7 - Prob. 17PECh. 7 - Prob. 18PE
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Using Paython Write a program that asks a student for his grade (out of 100) in 3 exams and then print out his final grade (out of 100), given that the weight of the first exam is 30%, the second 30%, and the third 40%.Example Input:Exam1: 70Exam2: 80Exam3: 90Example Output:Total Grade = 81Explanation: 0.3 * 70 + 0.3 * 80 + 0.4 * 90 = 81arrow_forwardthe electrical resistance r (in ohms) of a metal wire is given by the formula r = (ml)/ a where m is the resistivity of the metal; l is the lenght of the wire in feer, and a is the cross-sectional area of the wire ( in the circular mils) write a program that allow user to input for l and a for a copper whose resistivity m of copper is 10.4. Calculte the resistance of a wirearrow_forwardThe user must be able to enter the information for a number of bookings from the keyboard. Ask whether a booking must be made (Y or N). If a booking must be made, a random 3 digit flight number must be generated. The user must be asked to enter the type of seat, the price per seat and the number of seats to book. Example of input: Make a booking (Y or N)? :Y Type of seat (E or B): e Price per seat: 1200 Number of seats: 2 Make another booking (Y or N)? :y Type of seat (E or B): b Price per seat: 3400 Number of seats: 2 Make another booking (Y or N)? :y Type of seat (E or B): e Price per seat: 1400 Number of seats: 3 Make another booking (Y or N)? :y Type of seat (E or B): e Price per seat: 1300 Number of seats: 2 Make another booking (Y or N)? :y Type of seat (E or B): b Price per seat: 4500 Number of seats: 2 Make another booking (Y or N)? :narrow_forward
- Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.arrow_forwardWrite a program that reads an integer age of kids, finds the maximum of them, and counts its occurances, finds the minimum of them, and counts its occurances. And Find the average ages. Assum that the input ends with number -1.arrow_forwardCoral Help Write a program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are:spring: March 20 - June 20summer: June 21 - September 21autumn: September 22 - December 20winter: December 21 - March 19arrow_forward
- A supermarket is doing a sales promotion for soft drinks. If one day you buy soft drinks and bring the empty bottles the next day, they exchange each set of K empty bottles for a full one. A customer wants to make the most of this offer and therefore bought several bottles on the first day of the promotion. Now he wants to know how many bottles he will have at the end of the second day of the promotion if he use it to the fullest. Make a program to calculate this. Input The first input line contains integer T (1 ≤ T ≤ 10000), which indicates the number of test cases. In each of the following T lines come two integers N and K (1 ≤ K, N ≤ 10000), respectively the number of soft drinks bought and the number of empty bottles to gain a full. Output For each test case print the number of bottles that the customer will have on the second day, if he makes the most of the offer.arrow_forwardDescription A mathmatician Goldbach's conjecture: any even number(larger than 2) can divide into two prime number’s sum.But some even numbers can divide into many pairs of two prime numbers’ sum. Example:10 =3+7, 10=5+5, 10 can divide into two pairs of two prime number. Input Input consist a positive even number n(4<=n<=32766). Output Print the value of how many pairs are this even number can be divided into. Sample Input 1 1234 Sample Output 1 25arrow_forwardA bullet train slows from a speed of 200 mi/hr to 150 mi/hr in one minute. Write a computer program that calculates the bullet train’s constant rate of acceleration and determines how long the bullet train will take to come to rest, given an initial speed of 200 mi/hr. (Hint: Use the equation a = vf - vi t where a is acceleration, t is time interval, vi is initial velocity, and vf is final velocity.) Write and call a function that displays instructions to the program user and a function that computes a, given t, vf, and vi. using c programming languagearrow_forward
- Write a program that reads integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0. Write a program that reads integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0. Here is a sample run of the program: Enter integers from 1-100 (input 0 value to end inputs): 2 5 6 5 4 3 23 43 2 02 occurred 2 times3 occurred 1 time4 occurred 1 time5 occurred 2 times6 occurred 1 time23 occurred 1 time43 occurred 1 timearrow_forwardWrite a program which: 1. prints all multiples of 5 between 5 and 50 inclusive and then 2. reads a number from the user and prints out if it is zero, above zero, or below zeroarrow_forwardWrite a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 Ex: If the input is: 11 the output is: 11 Ex: If the input is: 9 or any value not between 11 and 100 (inclusive), the output is: Input must be 11-100 this is what i have n = int(input())if n > 100 or n < 11:print('Input must be 11-100')exit(0)while True:print(n, end=" ")first_digit = n // 10second_digit = n % 10 if first_digit == second_digit:break n = n-1 my output is 93 92 91 90 89 88 but it needs to be 93 92 91 90 89 88arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY