Question
PYTHON CODE 8. Write the code to display the result of subtracting 15 from 43 9. Write the code to display the result of multiplying
PYTHON CODE
8. Write the code to display the result of subtracting 15 from 43
9. Write the code to display the result of multiplying 15 and 43
10. Write the code to display the result of dividing 156 by 12
11. Write the code to display the result of dividing 21 by 0.5
12. Write the code to display the result of adding 111 and 84 and subtracting 45 times 2
13. Write the code to display the result of adding 21 and 4 and then multiplying the sum by 4
14. Write the code for a Multiplying Calculator:
Define/create multiply() function
Get User input() of two strings that are whole numbers (num1, num2)
Cast the input to int()
Multiply the two integers (answer will go in variable named: product)
Return the entire equation with the result as a str() Example output: 9 * 13 = 117
15. Write the code for Improved Multiplying Calculator:
Revise the previous program to multiply OR divide
Use a single parameter called operator with arguments * or /
Default operator is * multiply
Return the result of the multiplication or division calculation
If operator is other than * or / then return the message Invalid Operator
16. Find the error in the following code. Write it correctly and run it. Include comments to identify the errors. Python Programming I Honors 40460
StudentName = inpt("enter name: ").capitalize()
if studentName.startswith("F"):
print(studentName,"Congratulations, names starting with 'F' get to go first today)
elif studentName.startswith("G")
print(studentName Congratulations, names starting with 'G' get to go second today!)
else:
prnt(student_name, "please wait for students with names staring with 'F' and 'G' to go first today.")
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