+ 1
reversed number
There are two ways to create the program that will give you a reversed version of the number that you put in. Are these two codes readable,guys? first way: a=int(input("enter a number here")) print(a) x=a%10 y=a//10 y=str(y) print(str(x)+y[::-1]) second way: a=str(input("enter a number here")) x=a[: :-1] print(x)
3 ответов
+ 3
There are LOTS of ways. Here are 2. one long and one short.
number=str(input())
def flip(x):
num=[]
rev=""
for i in range(len(x)):
num.append(x[i])
num.reverse()
for i in num:
rev=rev+i
return rev
print(flip(number))
print(str(input("Enter a number: "))[: :-1])
+ 1
Yeah they are
+ 1
thanks bro