Question

In: Computer Science

this is a python code: QUESTION 3: Imagine that the IRA is giving stimulus package in...

this is a python code:

QUESTION 3:
Imagine that the IRA is giving stimulus package in the COVID-19 season. The package amount is determined by the number of adults in the family and the total amount of salary the family gets.

Each adult will get 1200 dollars if the total salary is 100000 or less.

Each adult will get 800 dollars if the total salary is 150000 or less.

Write a python program to ask the user the number of adults in the family and total number of family salary and determine the total amount of stimulus package the IRA will provide for that family.

QUESTION 4:

Write a program that will ask user length and width of a right triangle and find the area of the right angled triangle. The formula for finding the area of right angle triangle is

ab/2. Also find out the result if you calculate as (ab)/2. Is it the same? If it is same, why it is the same. If it is not the same, why it is not the same.

Solutions

Expert Solution

Question 3:

Source Code:

Output:

Code to Copy (refer above images of code for indentation):

#read number of adults from user
adults=int(input("Enter number of adults: "))
#read family salary from user
salary=float(input("Enter salary of the family: "))
#check for salary and calculate amount
if(salary<=100000):
amount=adults*1200
elif(salary>100000 and salary<150000):
amount=adults*800
else:
amount=0
#print total amount
print("The total amount of stimulus package is: ",amount)


Question 4:

Source Code:

Ouput:

Code to Copy (Refer above image of code for indentation):

#read length and width of right triangle
a=int(input("Enter the length of a right triangle: "))
b=int(input("Enter the width of a right triangle: "))
#calulate area
area=a*b/2
aarea=(a*b)/2
#print area
print("Area using ab/2 =",area)
print("Area using (ab)/2 =",aarea)

ab/2 and (ab/2) are same because there are two operations in both those are multiplication and division there is no problem in result whenever any operation is evaluated first in this case.

Ex:

5*4/2 = 5*2=10 (4/2 =2)

(5*4)/2 = 20/2 =10 (5*4=20)

The result is same


Related Solutions

Three ways in which the Coronavirus Stimulus Package differs from the 2009 Stimulus Package.
Three ways in which the Coronavirus Stimulus Package differs from the 2009 Stimulus Package.
How can we measure the effectiveness of the stimulus package?
How can we measure the effectiveness of the stimulus package?
As part of the economic stimulus package of the Australian Government at the start of 2009,...
As part of the economic stimulus package of the Australian Government at the start of 2009, many Australian households received a cash payment of up to $900 from the Government. Assume that all these payments were made on the same day. If the Reserve Bank had taken no action that day, what would have happened to interest rates in Australia? What steps would the Reserve Bank have had to take to prevent this from happening?
As a part of the stimulus package ($93 billion) was paid out in the form of...
As a part of the stimulus package ($93 billion) was paid out in the form of tax credits . Use the parameters given in the table below and the equation of IS Curve to answer the following questions: Autonomous Consumption (C) = $1.3 trillion mpc = 0.6 Autonomous Investment (I) = $1.2 trillion c = 0.1 Government Spending (G) = $3.0 trillion d = 0.2 Tax Revenue (T) = $3.0 trillion x = 0.1 Net Exports (NX) =1.3 trillion financial...
1. Please program the following in Python 3 code. 2. Please share your code. 3. Please...
1. Please program the following in Python 3 code. 2. Please share your code. 3. Please show all outputs. Instructions: Run Python code  List as Stack  and verify the following calculations; submit screen shots in a single file. Postfix Expression                Result 4 5 7 2 + - * = -16 3 4 + 2  * 7 / = 2 5 7 + 6 2 -  * = 48 4 2 3 5 1 - + * + = 18   List as Stack Code: """...
Python 3 Fix the code and rovide the correct indentation Code: import tkinter as tk from...
Python 3 Fix the code and rovide the correct indentation Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20) tk.Label(window, text="Failed date").grid(row=4, sticky="W", pady=20, padx=20) # entries barcode = tk.Entry(window) product = tk.Entry(window) money =...
Python 3 Fix the code so if the user enter the same bar code more than...
Python 3 Fix the code so if the user enter the same bar code more than three times, it shows a warning message indicating that the product was already tested 3 times and it reached the limits Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1, weight=1) window.grid_rowconfigure(1, weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20,...
Which of the following is NOT an epigenetic stimulus/marker used to package DNA? Select one: -...
Which of the following is NOT an epigenetic stimulus/marker used to package DNA? Select one: - Ubiquitination - Methylation - Phosphorylation - Acetylation
When the U.S. Government proposes a fiscal stimulus package during a recession there is usually a...
When the U.S. Government proposes a fiscal stimulus package during a recession there is usually a debate in Congress as to whether the Government should: 1) increase spending directly such as building bridges and schools; or 2) reduce personal income taxes. Using the concepts of U.S. GDP accounting based on the expenditure approach: (p. 749 ch 30) Explain why each of the two options would have a different initial impact on U.S. GDP How could the positive expenditure impact on...
Python CODE for this question: There are 2 red marbles and 98 blue marbles in a...
Python CODE for this question: There are 2 red marbles and 98 blue marbles in a jar. Draws are made at random with replacement. Find the smallest number of draws needed such that the probability is greater than 1/2 that a red marble is drawn at least once.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT