Question
2) Indicate after each if the println or assignment statement is VALID or INVALID. A statement is VALID if it has no compilation/syntax error. Otherwise,
2)Indicate after each if the println or assignment statement is VALID or INVALID. A statement is VALID if it has no compilation/syntax error. Otherwise, it is INVALID. If it is INVALID, list what the error is.
- print ("Here is some output.")
- print ("And some more ...)
- print ("Add this string + to this one.")
- print ("The capital of Alaska", "is Juneau.")
3) Write a Python program that displays lyrics from the song Somewhere Over the Rainbow from The Wizard of Oz. Here are the lyrics:
Somewhere over the rainbow way up high,
There's a land that I heard of once in a lullaby.
Somewhere over the rainbow skies are blue,
And the dreams that you dare to dream really do come true.
Somewhere over the rainbow bluebirds fly.
Birds fly over the rainbow. Why then, oh why can't I?
You may start with the Python Template available on Blackboard. Complete the header comment by replacing
print ()
4) Write a Python program to determine the pays and taxes on a paycheck based on an hourly rate (data type float) and the number of hours worked (data type int). Calculate the gross pay, federal tax, FICA (Social Security and Medicare) tax, state tax, and net pay based on the hourly rate and time worked. Here are the formulas:
gross pay = hourly rate * time worked
federal tax = gross pay * 0.15
FICA tax = gross pay * 0.0765
state tax = gross pay * 0.0435
net pay = gross pay federal tax FICA tax state tax
You may start with the Python Template, or sample code available on Blackboard. The program prompts the user for an hourly rate and a number of hours worked. It then performs the calculations. Finally, it shows the two inputs and the five outputs (calculations) on the screen. Include the units ($/hour, hours, $) for each input/output value, and show one input/output per line. Format each number in the output to two decimal places. This may be accomplished with the Python formatted print statement. Here is an example:
print ("Gross pay: ${0:10.2f}".format(grossPay))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started