Questions Uploads
values, X and Y
/in Questions Uploads /by adminWe will pass in 2 values, X and Y. You should calculate X
Y
XY and output only the final result.
You will probably know that X
Y
XY can be calculated as X times itself Y times.
# Get X and Y from the command line
import sys
X= int(sys.argv[1])
Y= int(sys.argv[2])
# Your code goes here
I have no idea how to attempt this one!
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
Milestone One: Pseudocode Submission
/in Questions Uploads /by adminuses of variables
/in Questions Uploads /by adminIn this code I need to “identify examples of three uses of variables in the script using comments in your code.” Specifically, an example of:
- assigning a numerical or string value to a variable
- changing variable values
- modifying values with data-type-appropriate operators, which basically means using things like int().
As well as “Identify examples of the use of branches and explain using comments in your code. Be sure your comments identify the following fundamental statements: if, elif, and else statements.”. Can anyone please help.
import sys
#The user must input the rental code as B, D, or W
rentalCode = input(“(B)udget, (D)aily, or (W)eekly rental?n”)
#Depending on the previous input for the rental code the next lines of code will provide a specific prompt
#to obtain the next input data
if rentalCode == “B”:
rentalPeriod = input(“Number of Days Rented:n”);
elif rentalCode == “D”:
rentalPeriod = input(“Number of Days Rented:n”);
elif rentalCode == “W”:
rentalPeriod = input(“Number of Weeks Rented:n”);
#The variables required to calculate the cost for each type of rental code
budgetCharge = 40.00
dailyCharge = 60.00
weeklyCharge = 190.00
#This will calculate the cost for each rental cost based on the user input.
if rentalCode == “B”:
baseCharge = int(rentalPeriod) * float(budgetCharge);
elif rentalCode == “D”:
baseCharge = int(rentalPeriod) * float(dailyCharge);
elif rentalCode == “W”:
baseCharge = int(rentalPeriod) * float(weeklyCharge);
#This block will calculate the total miles driven.
odoStart = input(“Starting Odometer Reading:n”)
odoEnd = input(“Ending Odometer Reading:n”)
totalMiles = int(odoEnd) – int(odoStart)
#This block states that is the rental code ‘B’ is input, the milage will automatically be calculated.
if rentalCode == “B”:
mileCharge = float(totalMiles) * 0.25;
#if the rental is a daily then we need to calculate the mileage charge by figuring out the average miles per day
#once we have the average miles that is then multiplied by a set rate of $0.25 per mile
elif rentalCode == “D”:
averageDayMiles = float(totalMiles)/float(rentalPeriod);
if float(averageDayMiles) <= 100:
extraMiles = 0;
else:
extraMiles = float(averageDayMiles) – 100;
mileCharge = (.25 * extraMiles);
#If the rental code is weekly the we need to calculate the mileage charge by again figuring out the average miles per week
#when the average number of weekly miles is greater then or equal to 900 then the mileage charge is zero i) Calculate the averageWeekMiles (totalMiles/ rentalPeriod)
#The charge will be $100.00 per week for extra miles if the avarge is more then 900 miles per week.
elif rentalCode == “W”:
averageWeekMiles = float(totalMiles)/float(rentalPeriod);
if averageWeekMiles <= 900:
mileCharge = 0;
else:
mileCharge = 100 * float(mileCharge)
#By adding the base charge and the milage charge the code will calculate the amount due.
amtDue = float(baseCharge) + float(mileCharge)
#this code will print a receipt for the customer and giving them a summary of all of the charges.
print(“Rental Summary”)
print(“Rental Code: ” + str(rentalCode))
print(“Rental Period: ” + str(rentalPeriod))
print(“Starting Odometer: ” + str(odoStart))
print(“Ending Odometer: ” + str(odoEnd))
print(“Miles Driven: ” + str(totalMiles))
print(“Amount Due: ” + “$” + str(amtDue) + ‘0’)
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
About Us
![]()
Since 2010, we have offered professional writing services to clients all over the world.
Over the years, our writers have gained solid experience in all academic disciplines, giving them a competitive edge to provide only first-rate academic papers.
![]()
QUICK LINKS
Contact Us
For any questions, feedback, or comments, we have an ethical customer support team that is always waiting on the line for your inquiries.
Talk to us
support@academicheroes.com
Call us: +1 (564) -222 6836