money = int(input()) price = int(input()) if money > price: print(money-price*10) if money < price: print("")
money = int(input()) price = int(input()) if money > price: print(money-price*10) if money < price: print("")
Pasteb1nА язык тут ни при чём. Ты алгоритмировать не умеешь.
Я новичок и стал изучать данный язык буквально вчера.
total_cost = price * 10 # ошибка 1 денег не хватит именно на все а не на одно мороженное if money>=total_cost: # ошибка 2 если денег в обрез то купить все-же можно print("остаток:",money-total_cost) else: # ошибка 3 У вас одно условие а не два print("денег не хватило") # Лучше писать что произошло Иначе потом вы будете думать что программа не запустилась сломалась и т.п.
price = int(input("price: ")) money = int(input("money: ")) if money / price < 10: print(None) else: print(money - (price * 10)) # можно (но не нужно) и так тоже #print(None) if money / price < 10 else print(money - (price * 10))
#вроде python 3.8 print(None) if (money := int(input("money: "))) / (price := int(input("price: "))) < 10 else print(money - (price * 10))