| Off Topic > Off Topic |
| Programming Megathread |
| << < (55/241) > >> |
| Alyx Vance:
It was solved with "d = int(a)*int(b)" Thanks for the help though |
| Foxscotch:
addendum: you can multiply a string by an integer, it just adds the string to itself so 'hi'*4 == 'hihihihi' |
| Alyx Vance:
Well forget me again, ran into another problem that makes even less sense. --- Code: ---a = input("Enter tax rate: ") b = input("Enter amount paid ") c = input("Enter how many times paid ") d = int(a)*int(b)\100 print(d + e) --- End code --- 'unexpected character after line continuation character' it goes away if I remove the \100 |
| Foxscotch:
"line continuation character" == \ that is a backslash, bub regular slash, /, is for division. backslash is for escaping also don't stick everything so close together int(a) * int(b) / 100 is 10x more readable than the alternative with no spaces ALSO don't give your variables vague names like that. + some other small changes revised entire thing: tax_rate = int(input("Enter tax rate: ")) pay_rate = int(input("Enter amount paid ")) times_paid = int(input("Enter how many times paid ")) total_income = tax_rate * pay_rate / 100 print(total_income + e) although honestly the whole thing doesn't make much sense. why are you dividing by 100? what is e? |
| Alyx Vance:
The e was a typo, and thanks for clearing that up. |
| Navigation |
| Message Index |
| Next page |
| Previous page |