Fix the errors in the code, and change it to use only one if statement. The code should print βThe number is 5β when the number is 5, and should print βThe number is NOT 5β when it is not.
Fix the errors in the code, and change it to use only one if statement. The code should print βThe number is 5β when the number is 5, and should print βThe number is NOT 5β when it is not.
Complete the pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours, if the regular pay rate is $10 an hour. Then set grossPay equal to the amount an employee would be paid for working 45 hours.
Complete the pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours, if the regular pay rate is $10 an hour. Then set grossPay equal to the amount an employee would be paid for working 45 hours.
Rewrite your pay program using try and except so that your program handles non-numeric input gracefully by printing a message and exiting the program. The following shows two executions of the program:
Write the code to calculate and print the cost of a 14 mile cab ride. If the distance traveled is less than or equal to 12 miles the cost is $2.00 a mile, and if the distance traveled is more than 12 miles the cost is $1.50 a mile. Assign the final cost to the variable total.
Write the code to calculate and print the cost of a 14 mile cab ride. If the distance traveled is less than or equal to 12 miles the cost is $2.00 a mile, and if the distance traveled is more than 12 miles the cost is $1.50 a mile. Assign the final cost to the variable total.
Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a grade using the following table:
Write a procedure that takes 2 ints, total price, and amount in wallet. Print βYou have enough moneyβ if the difference between the wallet and price is 0 or greater; otherwise, print βGet more moneyβ.
Write a program that takes a year as a parameter and sets leapYear equal to True if the year is a leap year, False otherwise. (use a few different years to test your work)
Finish the following code. It first sets n to a number input by a user. Convert the number from a string to an integer and set result to True if the number is an even number (evenly divisible by two) and False if it is odd. Note: use the modulo operator.