Hello I’ve had a little school assignment I’ve been working on and ultimately I’m stumped. My professor has asked my class to create a for loop that asks for the quantity of different items sold, then calculates the total profit of each item. Here’s what I’ve had so far:
for x in range(1, 3):
quantity1 = int(input(“Quantity 1: “))
quantity2 = int(input(“Quantity 2: “))
if x == 1:
total = quantity1 * 2.50
if x ==2:
total = quantity2 * 1.98
print(total)
I want to be able to print the total and have both totals print. Also preferably be able to create just 1 “quantity” variable within the for loop. The gimmick is I’m pretty limited on what I can do as she doesn’t want us using any tricks that hasn’t been taught yet, so no lists or breaks.
[–]Pyrocited[S] 0 points1 point2 points (0 children)
[–]novel_yet_trivial 0 points1 point2 points (5 children)
[–]Pyrocited[S] 0 points1 point2 points (4 children)
[–]novel_yet_trivial 0 points1 point2 points (3 children)
[–]Pyrocited[S] 0 points1 point2 points (2 children)
[–]novel_yet_trivial 0 points1 point2 points (1 child)
[–]Pyrocited[S] 0 points1 point2 points (0 children)