python - How to calculate percent and add it to the amount -
one question. code is:
preis = input("preis: ") preis1 = preis / 100 preis2 = preis1 * 1.9 preis3 = preis + preis2
lets preis input user makes 100 , should 100 / 100 = 1 (result price1 1). final output should 101.9. not right because not working :)
for one, input() returns string, you'll need convert int.
preis = int(input("preis: "))
apart that, code should work, might want read style guide; don't need declare new variable every step.
Comments
Post a Comment