Apr-27-2017, 12:15 PM
There are several things wrong with your code:
1. You're printing, not returning a value.
2. The values you pass are strings, so the condition on the
If you need to try and parse a string as an integer, use the
1. You're printing, not returning a value.
2. The values you pass are strings, so the condition on the
elif
doesn't make sense.If you need to try and parse a string as an integer, use the
int()
function. It raises an exception of type ValueError
when its argument can't be converted, so you'll need to use a try
/except
to handle that.