Question

In: Computer Science

CODE IN PYTHON 1. Write a program that asks the user for the number of slices...

CODE IN PYTHON

1. Write a program that asks the user for the number of slices of pizza they want to order and displays the total number of dollar bills they owe given pizza costs 3 dollars a slice.  Note: You may print the value an integer value.

2. Assume that y, a and b have already been defined, display the value of x:

x =   ya+b   

3. The variable start_tees refers to the number of UD T-shirts at the start of New Student Orientation (NSO) and dist_tees refers to the number of UD T-shirts distributed to students at NSO. Write an expression that calculates the total number of UD T-shirts left after NSO and assign it to the variable end_tees.

Note: you should NOT assign values to start_tees and dist_tees! It will be assigned before your code is run!

4. Write a program that asks the user for the number of slices of pizza they want to order and displays the total number of dollar bills they owe given pizza costs 3 dollars a slice.  Note: You may print the value an integer value.

Solutions

Expert Solution

Answer: here is the answer for your question :

part 1 & 4) since , your part 1 and 4 are same. i will answer it only once as both are same questions:

here in the python code :

---------------------------------------------------------------------------------------------------------------------------------------


print("PIZZA BILLING PROGRAM!!!!")
no_of_slices=int(input("Enter the number of slices that you want to order:"))#taking input from user
print("your total bill for pizza is {} dollar ".format(no_of_slices*3))#printing output to the screen

----------------------------------------------------------------------------------------------------------

CODE SNIPPET AND OUTPUT:

------------------------------------------------------------------------------------------------------

Part 2)

python code:

---------------------------------------------------------------------------------------------------------------------------------------
print("PART 2")
a=10
b=8
y=5
x=y*a+b #assign value to x
print("value of y is {}".format(y))#printing value to console

---------------------------------------------------------------------------------------------------------------------------------------

CODE SNIPPET AND OUTPUT:

PART 3:

python code:

---------------------------------------------------------------------------------------------------------------------------------------
print("PART 3")
start_tees=int(input("Enter no of t-shirts at starting:"))#geting input for start tees from user
dist_tees=int(input("Enter no of t-shits that are distributed: "))#geting input for dis_tees from user
end_tees=start_tees-dist_tees
print("no fo tees remaining after distribution is {}".format(end_tees))#printing value to console

---------------------------------------------------------------------------------------------------------------------------------------

CODE SNIPPET AND OUTPUT:

-------------------------------------------------------------------------------------------------------------------------------------------

I hope this would help you out

If you have any doubt, you can provide comment /feedback below the answer

Thanks


Related Solutions

Python. Write a code that asks the user to enter a string. Count the number of...
Python. Write a code that asks the user to enter a string. Count the number of different vowels ( a, e, i, o, u) that are in the string and print out the total. You may need to write 5 different if statements, one for each vowel. Enter a string: mouse mouse has 3 different vowels
Write a Python program tat asks the user for the number of equations (n) to be...
Write a Python program tat asks the user for the number of equations (n) to be solved and fill the coefficient matrix A and the right matrix b with random integers. Limit the values of the elements of A to numbers between 0 and 50 and elements of b to 0 and 500. Lastly, put the matrices into an Excel file.
Please write in Python code please: Write a program that asks the user to enter 5...
Please write in Python code please: Write a program that asks the user to enter 5 test scores between 0 and 100. The program should display a letter grade for each score and the average test score. You will need to write the following functions, including main: calc_average – The function should accept a list of 5 test scores as an input argument, and return the average of the scores determine_grade – The function should accept a test score as...
PYTHON: Write a program that asks the user to enter a 10-character telephone number in the...
PYTHON: Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663. This is my code, but I cannot figure out where to go from here. #set new number new_number = "" #split number split_num = phone.split("-") for char in split_num[1:2]:...
Write a python program which asks the user to enter a positive number that is greater...
Write a python program which asks the user to enter a positive number that is greater than 30 called, “num2” and then does the following: o 1) Print all numbers between 1 and “num2” that are divisible by 2 and 3. o 2) Print all numbers between 1 and “num2” that are either divisible by 6 or 7. o 3) Print all numbers between 1 and “num3” that is not divisible by 5
Python Programming 4th edition: Write a program that asks the user for the number of hours...
Python Programming 4th edition: Write a program that asks the user for the number of hours (float) and the pay rate (float) for employee pay role sheet. The program should display the gross pay with overtime if any and without overtime. Hints: Given base_hr as 40 and ovt_multiplier as1.5, calculate the gross pay with and Without overtime. The output should look like as follows: Enter the number of hours worked: Enter the hourly pay rate: The gross pay is $XXX.XX
---- Python CIMP 8A Code Lab 4 Write a program that asks the user to enter...
---- Python CIMP 8A Code Lab 4 Write a program that asks the user to enter 5 test scores. The program will display a letter grade for each test score and an average grade for the test scores entered. The program will write the student name and average test score to a text file (“studentgrades.txt”). Three functions are needed for this program. def letter_grade( test_score) Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F...
Python: Write a program that asks the user for the name of a file. The program...
Python: Write a program that asks the user for the name of a file. The program should display the contents of the file line by line.
In Python write a program that asks the user to enter the monthly costs for the...
In Python write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance the program should then display the total monthly cost of these expenses, and the total annual cost of these expenses. your program MUST have BOTH a main function AND a function named calcExpenses to calculate the expenses. DO NOT display the expenses inside of the calcExpenses function!!...
write a program that: 1) asks the user to enter grades, a negative number is the...
write a program that: 1) asks the user to enter grades, a negative number is the signal to stop entering. (while loop) - add each grade to a list (do not add the negative number to the list) after the while loop to enter grades is finished: 2) use a for loop on the list to calculate the average of all numbers in the list 3) use a for loop on the list to find the largest number in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT