pyschool is wrong ?
- by geekkid
I'm currently learning python and trying to do exercises at pyschools (if anyone knows what it is). Anyway, i have an exercise that asks me to do the following : Write a function percent(value, total) that takes in two numbers as arguments, and returns the percentage value as an integer.
Here's my code:
def percent(value, total):
percent = value / total * 100
return int(percent)
It works great in my Python Idle and it gives all the correct answers. however, when i run it in the pyschools website, it says that , for example , when the function is called with parameters 46 and 90 , the function returns 0. However, in my python idle , it correctly returns 51.
What might be the problem ?
Thank you very much for your help!