(08-21-2015, 08:46 PM)Jolly Wrote: This is quite clever to be honest!
However, why doesn't it get an error since Input() returns a string value, but you are operating with integers.
So, here's the difference:
In Python 2, we have
raw_input(), which reads a string. This is equivalent to Python 3's
input(). In Python 2, we have
input() too. However, ours essentially performs the operation
eval(raw_input()), which interprets the string given and tries to figure out it's type, and casts the value to that. So, with
input() in Python 2, you can interpret pretty much any type that exists in Python as input! You can replicate it in Python 3 with
eval(input()), but at that point you may as well be using the appropriate name if it's shorter, like
int(input()).