Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

{ cells: [ { cell _ type: markdown, id : 7 2 a 5 ddfa, metadata: { id :

{
"cells": [
{
"cell_type": "markdown",
"id": "72a5ddfa",
"metadata": {
"id": "72a5ddfa"
},
"source": [
"# Guided Practice Conditional Statements"
]
},
{
"cell_type": "markdown",
"source": [
"### Try each of the Codes by pressing the Play button. You can modify the code and run again to see the outputs. Activities that need to be completed by the student are numbered.
",
"### Answer the questions and download your completed activity with full outputs as a .ipynb and a .pdf file. Use the Print option in the web browser to download the .pdf file. In your Chrome browser, press CTRL+P and select Set the Destination to \"Save as PDF\" or \"Print to PDF\" or the apropriate selection based on your computer. Save the file and submit your .pdf file and .ipynb in Canvas. A video on this process can be viewed using this [link](https://ecpi.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=2c60ba53-b182-4dd2-ba40-b12901260d39) or by running the code block below this. Thanks!"
],
"metadata": {
"id": "3AieqSoCPSvn"
},
"id": "3AieqSoCPSvn"
},
{
"cell_type": "code",
"source": [
"# Download Colab Notebook as .pdf and .ipynb Instructions
",
"
",
"from IPython.display import HTML
",
"
",
"HTML(\"\"\"
",
"
",
"\"\"\")"
],
"metadata": {
"id": "dTJXQoArH6Cp"
},
"execution_count": null,
"outputs": [],
"id": "dTJXQoArH6Cp"
},
{
"cell_type": "markdown",
"id": "0e20c8db",
"metadata": {
"id": "0e20c8db"
},
"source": [
"# Activity 2.1
",
"## Modify the program below to demonstrate the following:
",
"1. Calculate the total tax amount using a tax percentage of 40% if the gross pay is greater than 7500 and 20% if it is less than or equal to 7500.
",
"2. Use the calculated tax amount in dollars to subtract from gross pay and display the net pay"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51f91cda",
"metadata": {
"id": "51f91cda"
},
"outputs": [],
"source": [
"# Activity 2.1
",
"#Variables to represent the base hours and
",
"# the overtime multiplier.
",
"base_hours =40 # Base hours per week
",
"ot_multiplier =1.5 # Overtime multiplier
",
"
",
"# Get the hours worked and the hourly pay rate.
",
"hours = float(input('Enter the number of hours worked: '))
",
"pay_rate = float(input('Enter the hourly pay rate: '))
",
"
",
"# Calculate and display the gross pay.
",
"if hours > base_hours:
",
" # Calculate the gross pay with overtime.
",
" # First, get the number of overtime hours worked.
",
" overtime_hours = hours - base_hours
",
"
",
" # Calculate the amount of overtime pay.
",
" overtime_pay = overtime_hours * pay_rate * ot_multiplier
",
"
",
" # Calculate the gross pay.
",
" gross_pay = base_hours * pay_rate + overtime_pay
",
"else:
",
" # Calculate the gross pay without overtime.
",
" gross_pay = hours * pay_rate
",
"
",
"# Display the gross pay.
",
"print('The gross pay is $', format(gross_pay, ',.2f'), sep='')
",
"
",
"#Calculate tax
",
"
",
"
"
]
},
{
"cell_type": "markdown",
"id": "c3b7a58e",
"metadata": {
"id": "c3b7a58e"
},
"source": [
"# Activity 2.2
",
"##Modify the program below to demonstrate the following:
",
"1. Ask the user for their credit_score.
",
">For the user to be qualified for the loan they must have:
",
">1. Minimum credit score of 600
",
">2. A minimum salary greater than min_salary (line 5)
",
">3. A minimum credit age of min_years (line 6)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f8590cd",
"metadata": {
"id": "7f8590cd"
},
"outputs": [],
"source": [
"# Activity 2.2
",
"#This program determines whether a bank customer
",
"# qualifies for a loan.
",
"
",
"MIN_SALARY =3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Would you be willing to work with them?

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

What are the steps in the T&D process?

Answered: 1 week ago

Question

Define training and development.

Answered: 1 week ago