Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 7, Problem 8PE
Program Plan Intro

Find eligibility

Program plan:

  • Define the function “main()”,
    • Get the years of citizenship and age of a person.
    • Check whether the year of citizenship is greater than or equal to “9”,
      • If it is true, check whether the age is greater than or equal to “30”,
        • If it true, print a message as “Person is eligible to serve as a U.S. Senator, or a member of the House.".
        • Otherwise, check whether the age is lies between "25" and "29".
          • If it is true, print a message as “Person is eligible to run for the House of Representatives.".
          • Otherwise, print a message as “Sorry, but the person is not eligible to serve as a congressional representative”.
        • Otherwise print a message as “Sorry, but the person is not eligible to serve as a congressional representative”.
      • Call the function “main()”.

Blurred answer
Students have asked these similar questions
PRG10: Write a program that accepts dates written in numerical form and outputs in complete form. :5 26 1986 : May 26, 1986 Enter date in number form Your date in complete form is PRG11: Write a program that will calculate and show bills of the Manila Electric Company. The rates vary depending on whether the useR is residential (R), commercial( C) , or industrial (I). Any other code should be treated as an error. The program should accept the subscriber ID, Subscriber Name, his total electrical consumption in a month, and the code of the consumer type. The rates are computed as follows: R: 50 plus .50 per kwh used C: 100 for the first 1000 kwh and 0.45 for each additional kwh I: 180 for the first 1000 kwh and 0.75 for each additional kwh PRG12: Write a program that will simulate the Paper, Rock, Scissors game. Two players should be able to either P, R or S then the program shall determine who the winner is and state why he wins based on the following criteria: Sample Output Paper…
Transient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…
Airline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönder
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
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