I keep getting the error:
Import block is un-sorted or un-formatted with my code:
def __init__(self, num_items, item_price):
self.num_items = num_items
self.item_price = item_price
def buy(self, req_items, money):
if req_items > self.num_items:
raise ValueError("Not enough items in the machine")
required_amount = req_items * self.item_price
if money < required_amount:
raise ValueError("Not enough coins")
self.num_items -= req_items
change = money - required_amount
if __name__ == '__main__':
num_items, item_price = map(int, input().split())
machine = VendingMachine(num_items, item_price)
n = int(input())
for _ in range(n):
num_items, num_coins = map(int, input().split())
change = machine.buy(num_items, num_coins)
except ValueError as e:
Vending Machine - Replit is the repl
It is just the pywright-extended being annoying.
Yeah I was about to say, there’s no errors.
Btw, can I pre-order a vending machine from you to keep in my house?
This is probably the fastest a post has been solved.
Ok now check out my repl (shameless plug lmao)
-Vending Machine - Replit
Its actually kinda fun XD
is pywright a new addition to the replit coding interface (like some sort of styler that doesn’t let you exec code without good styling lol)? Cuz I popped on replit for the first time in a century and it looked like completely different @CoderElijah
I think so. It is now some picky perfectionist program that says mean things.
this is just another bad move for replit. As a package creator (I made replit-bot which went semi-viral but also a lot of other things), you need to make sure when making things for distribution, everything needs to be opt-IN, not opt-OUT since people won’t know squat about how to turn it off
it’s not an error it’s a warning
I think it could be the fact that there seems to only be one newline between the imports and the
class VendingMachine:, but I could be wrong
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.