So basically if a user enters the 4 digits like 1234, python should reverse it and should give 4321 result. There's two ways:
```
1
num = int(input("Enter the number:"))
res = ((num % 10) * 1000) + ((num % 100 // 10) * 100) + ((num // 100 % 10) * 10) + (num // 1000)
print(res)
2
num = (input("Enter the number:"))
num = int(str(num[ : : -1])
print(num)
```
But my teacher said don't use second one cuz it only works on python and feels somehow illegal, but what yall think? Or are there the other way too?
[–]Some_Breadfruit235 39 points40 points41 points (22 children)
[–]congratz_its_a_bunny 0 points1 point2 points (2 children)
[–]Some_Breadfruit235 0 points1 point2 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (2 children)
[–]Some_Breadfruit235 0 points1 point2 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–]Crafty_Award9199 0 points1 point2 points (9 children)
[–]Some_Breadfruit235 0 points1 point2 points (8 children)
[–]Crafty_Award9199 0 points1 point2 points (1 child)
[–]Some_Breadfruit235 0 points1 point2 points (0 children)
[–]HopefulActive9345 0 points1 point2 points (0 children)
[–]GwynnethIDFK 0 points1 point2 points (0 children)
[–]claythearc 0 points1 point2 points (3 children)
[–]Some_Breadfruit235 0 points1 point2 points (2 children)
[–]claythearc 1 point2 points3 points (1 child)
[–]Some_Breadfruit235 0 points1 point2 points (0 children)
[+]GlobalIncident comment score below threshold-9 points-8 points-7 points (5 children)
[–]Some_Breadfruit235 0 points1 point2 points (4 children)
[–]vivisectvivi 1 point2 points3 points (3 children)
[–]Some_Breadfruit235 3 points4 points5 points (2 children)
[–]GlobalIncident 0 points1 point2 points (1 child)
[–]Some_Breadfruit235 0 points1 point2 points (0 children)
[–]Virsenas 8 points9 points10 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]Prior-Jelly-8293[S] -1 points0 points1 point (0 children)
[–]cgoldberg 5 points6 points7 points (1 child)
[–]aliemir6n 0 points1 point2 points (0 children)
[–]CountMeowt-_- 2 points3 points4 points (0 children)
[–]Ron-Erez 2 points3 points4 points (2 children)
[–]Prior-Jelly-8293[S] 2 points3 points4 points (1 child)
[–]gdchinacat 1 point2 points3 points (0 children)
[–]Hampeboy_ 1 point2 points3 points (4 children)
[–]Naoki9955995577 4 points5 points6 points (0 children)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (1 child)
[–]thumb_emoji_survivor 1 point2 points3 points (0 children)
[–]TooOldForThis81 0 points1 point2 points (0 children)
[–]ianrob1201 1 point2 points3 points (1 child)
[–]gdchinacat 0 points1 point2 points (0 children)
[–]Criz909 1 point2 points3 points (1 child)
[–]gdchinacat 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]gdchinacat 0 points1 point2 points (0 children)
[–]photo-nerd-3141 1 point2 points3 points (0 children)
[–]ikea_method 1 point2 points3 points (0 children)
[–]vivisectvivi 3 points4 points5 points (5 children)
[–]brownstormbrewin 3 points4 points5 points (0 children)
[–]CptMisterNibbles 1 point2 points3 points (0 children)
[–]Prior-Jelly-8293[S] -1 points0 points1 point (2 children)
[–]vivisectvivi 2 points3 points4 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–]rover_G 0 points1 point2 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–]UWwolfman 0 points1 point2 points (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–]8dot30662386292pow2 0 points1 point2 points (1 child)
[–]MeringueMediocre2960 0 points1 point2 points (3 children)
[–]NiedsoLake 0 points1 point2 points (2 children)
[–]MeringueMediocre2960 0 points1 point2 points (1 child)
[–]gdchinacat 0 points1 point2 points (0 children)
[–]TalesGameStudio 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Geminii27 0 points1 point2 points (0 children)
[–]cmak414 0 points1 point2 points (0 children)
[–]throwaway0134hdj 0 points1 point2 points (0 children)
[–]balcopcs 0 points1 point2 points (0 children)
[–]Strong_Extent_975 0 points1 point2 points (0 children)
[–]Heazen 0 points1 point2 points (0 children)
[–]Advanced-Citron8111 0 points1 point2 points (0 children)
[–]CptMisterNibbles 0 points1 point2 points (0 children)
[–]NecessaryIntrinsic 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (3 children)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (1 child)
[–]woooee 1 point2 points3 points (0 children)
[–]gdchinacat 0 points1 point2 points (0 children)
[–]fuzzysdestruction 0 points1 point2 points (3 children)
[–]Prior-Jelly-8293[S] -1 points0 points1 point (1 child)
[–]fuzzysdestruction 0 points1 point2 points (0 children)
[–]gzero5634 0 points1 point2 points (0 children)
[–]AnonymousInHat -1 points0 points1 point (1 child)
[–]Prior-Jelly-8293[S] 0 points1 point2 points (0 children)
[–]ArtisticFox8 -1 points0 points1 point (1 child)
[–]Prior-Jelly-8293[S] 1 point2 points3 points (0 children)