Suppose the PYTHON program below is run on your computer:
expenses = 0
while True:
answer = input("Give the price of the next item ordered?")
if answer == "end":
break
else:
price = float(answer)
expenses = expenses + price
print "Total value of orders is:", expenses
What changes would you make to the PYTHON program above so that it is clear that the values are all in pounds?
#Approach 1
#Ask user to enter amount in pounds
expenses = 0
while True:
#We have to ask user to enter amount in pounds
answer = input("Give the price of the next item ordered in pounds?")
if answer == "end":
break
else:
price = float(answer)
expenses = expenses + price
print("Total value of orders is:", expenses)
===================================
#Approach 2
#Ask user to enter amount in dollars and cnvert the final amount to pounds
expenses = 0
while True:
#We have to ask user to enter amount in pounds
answer = input("Give the price of the next item ordered in pounds?")
if answer == "end":
break
else:
price = float(answer)
expenses = expenses + price
print("Total value of orders is:", (expenses*0.76))

Suppose the PYTHON program below is run on your computer: expenses = 0 while True: answer...
Suppose the PYTHON program below is run on your computer: expenses = 0 while True: answer = input("Give the price of the next item ordered?") if answer == "end": break else: price = float(answer) expenses = expenses + price print "Total value of orders is:", expenses What changes should I make to the PYTHON program above so that it is clear that the values are all printed in pounds?
Can you please enter this python program code into an IPO Chart? import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the non-numbers #if user enters letters, then except will show the message, Numbers only! try: c=int(input("Enter your choice: ")) if(c>=1 and c<=3): return c else: print("Enter number between 1 and 3 inclusive.") except: #print exception print("Numbers Only!")...
Python: def combo(): play = True while play: x = int(input('How many people\'s information would you like to see: ')) print() for num in range(x): name() age() hobby() job() phone() print() answer = input("Would you like to try again?(Enter Yes or No): ").lower() while True: if answer == 'yes': play = True break elif answer == 'no': play = False break else: answer = input('Incorrect option. Type "YES" to try again or "NO" to leave": ').lower()...
USE PYTHON 3, RUN THE CODE BEFORE POSTING THE ANSWER, AND READ THE ASSIGNMENT REQUIREMENTS NOTE CAREFULLY: Assignment Requirements NOTE: This program requires the use of if, elif, else, and casting between strings and numbers. The program should use the various code syntax covered in module 3. The program must result in print output using numeric input similar to that shown in the sample output below. Program: Cheese Order set values for maximum and minimum order variables set value for...
. Use what you learned from our First Python Program to write a Python program that will carry out the following tasks. Ask user provide the following information: unit price (for example: 2.5) quantity (for example: 4) Use the following formula to calculate the revenue: revenue = unit price x quantity Print the result in the following format on the console: The revenue is $___. (for example: The revenue is $10.0.) . . Use the following formula to calculate the...
Can you add code comments where required throughout this Python Program, Guess My Number Program, and describe this program as if you were presenting it to the class. What it does and everything step by step. import random def menu(): #function for getting the user input on what he wants to do print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the...
This Python program will need to include the following items listed below. You are to customize your program and create the sequence in any order of your choice. Must include Python comments for each of the items shown below. Calculate a Percentage. For example, the discount percentage on a sale item. Use of 3 Constants. To be used for values that will not change throughout the life of the program. A Turtle Graphic Logo. This logo will be used to...
Using python, write code for problem. Please also put screenshot
of your code.
The following program will perform properly if the user enters 0 in response to the request for input. However, the program will crash if the user responds with "eight". Rewrite the program using a try/except statement so that it will handle both types of responses. See Fig. 6.1. while True: n = int (input ("Enter a nonzero integer: ")) if n! = 0: reciprocal = 1/n print...
Write a python program that runs only on the command-line prompt. i.e. if you run this program on IDEL it would give you an error message. Name the program “buy.py.” Assume that this program is used by a departmental store to calculate your total price if you want to buy an extended warranty for your purchased Computer. The program takes two arguments at the command-line prompt: 1) the computer’s brand name, and 2) the price of the computer that you...
Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that performs the following tasks. Open the file called M4Lab1ii.py linked below these instructions in your M4 Content module in IDLE. Save as M4Lab1ii.py. Replace ii with your initials. [example for someone with the initials cc: M4Lab1cc.py] Complete Steps 1-7 as requested within the code’s comments. Run your program and test all four calculations, then exit the program. Save your program as M4Lab1ii.py using your...