Basically flips the number given and returns the result integer.
# Takes int or string input # Returns int def flip_the_number(num): return int(str(num)[::-1])
- # Takes int or string input
- # Returns int
- def flip_the_number(num):
return num[::-1]- return int(str(num)[::-1])
Test.assert_equals(flip_the_number("12345"), 54321); Test.assert_equals(flip_the_number("1973572"), 2753791); Test.assert_equals(flip_the_number(1973572), 2753791);
Test.assert_equals(flip_the_number("12345"), "54321");Test.assert_equals(flip_the_number("1973572"), "2753791");- Test.assert_equals(flip_the_number("12345"), 54321);
- Test.assert_equals(flip_the_number("1973572"), 2753791);
- Test.assert_equals(flip_the_number(1973572), 2753791);