Python Decision Statements Practice

docx

School

Embry-Riddle Aeronautical University *

*We aren’t endorsed by this school

Course

NA

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

3

Uploaded by ConstableDinosaur3920

Report
Python Decision Statements Practice Assignment 1 (choose 3 of 4): 1. Vote Eligibility Checker - Write a program to check whether a person is eligible to vote or not. have the user input their age check to see if they are 18 or older display the result in a sentence 2. Odd or Even - Write a program to check whether a number is odd or even. have the user input a number check to see if the number is odd or even display the number and the result in a sentence 3. Equilateral Triangle Tester - Write a program that checks whether a triangle is equilateral or not. have the user input three numbers check to see if the three numbers are equal display the numbers and the result in a sentence 4. Which is Largest - Write a program to find the largest number of three given numbers. have the user input three numbers check to see which of the three numbers largest display the numbers and the result in a sentence
Assignment 2 (choose 2 of 3): 1. Write a program to check whether a year is a leap year or not. have the user input a year check to see if the year is a leap year display the year and the result in a sentence Note about Leap Years: A leap year is a year, occurring once every four years, which has 366 days including 29 February as an intercalary day. A Century year is a leap year only if it is perfectly divisible by 400. Leap Year Rules: How to Calculate Leap Years The year must be evenly divisible by 4; If the year can also be evenly divided by 100, it is not a leap year; The year is also evenly divisible by 400. Then it is a leap year. According to these rules, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300, and 2500 are not leap years. 2. Write a program to check if numbers are divisible by each other. have the user input two numbers check for divisibility (both ways) display the the numbers and the results in a sentences 3. Write a Grade Converter Program - Percent to Letter have the user input a number grade Convert it to the appropriate letter grade (see chart) display the the number and letter grade in a sentence Condition for grades: Less than 65: F 65-69: D 70-75: C 76-79: C+ 80-85: B 86-89: B+ 90-95: A 96-100:A+
Assignment 3 (choose one of the two): 1. Write a program to calculate a person’s electricity bill based on usage have user input their electricity usage for the month in kWh (kilowatt hours) calculate the total bill based on the chart below display the total balance due in a sentence Remember to format for currency Electricity Rates * a. first 250 kWh: $0.0916 per b. next 150 kWh $0.1162 per c. excess of 400 kWh $0.1162 plus excess usage fee of $0.0506 per *An additional surcharge of 17% is added to the bill SAMPLE INPUT AND OUTPUT: (You can use this to test your code) kWh used = 1100 Bill = $183.80 2. Write a Program to calculate ACTUAL TOTAL* Tax Rate based on the following: have user input their total annual salary calculate the total amount of taxes to be paid based on the chart below Calculate the actual total tax rate display the the salary, taxes paid, and actual total tax rate in a sentence Remember to format for currency a). the first $10,000 in salary is taxed at a rate of 0%. b). portion of salary between $10,000 and $25,000 is taxed at 6% c). portion of salary between $25,000 and $75,000 is taxed at 12% d). excess salary beyond $75,000 = 22% tax *The ACTUAL TOTAL tax rate would be the total amount paid in taxes compared to their total salary. SAMPLE INPUT AND OUTPUT: (You can use this to test your code) Salary = $87,000 Taxes paid = $9,540 Actual Total Rate = 10.97%
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help