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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -