def reverseNum(n): #user-defined function
         n = str(n)
         if n[0] == '-':
            a = n[::-1]
            return f"{n[0]}{a[:-1]}"
         else:
            return n[::-1]
      # take inputs
      num = input("inter a negative number:")
      # calling function and display result
      print('The reverse number is =', reverseNum(num))
      
      Python language logo

      Reverse negativeNum

      beginner
      logic

      Reversing a given negative number

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.