Skip to content

Instantly share code, notes, and snippets.

@kunthar
Created August 29, 2019 12:53
Show Gist options
  • Save kunthar/13645f01cf0d919d4fbf17dad31a3f9c to your computer and use it in GitHub Desktop.
Save kunthar/13645f01cf0d919d4fbf17dad31a3f9c to your computer and use it in GitHub Desktop.
check the integer if signed or unsigned
def check_if_signed():
try:
yournum = int(input('input a number: '))
if yournum >= 0:
print('Your number is unsigned.')
elif yournum < 0:
print('Your number is signed.')
else:
print('C\'mon give me numbers.')
except:
print('Something is wrong with your input')
@kunthar
Copy link
Author

kunthar commented Aug 29, 2019

@zarupdadev team, provide shorter and refactored version of this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment