def revintegers(int num): #-321
while num !=0 {
if num > 0{
mod = num % 10; #-1
num = num / 10; #
revorder = revorder * 10 + mod;
}
elif num < 0 {
num = -1 * num;
mod = num % 10;
num = num / 10;
revorder = (revorder * 10 + mod) * -1;
}
return revorder;
}
revintegers(321)
No comments:
Post a Comment