Created
August 11, 2016 15:39
-
-
Save dboyliao/b2eefa4c00b76c63f0c14d5deb8945bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
from __future__ import print_function | |
import sys | |
if sys.version_info.major < 3: | |
input = raw_input | |
def main(): | |
while True: | |
user_input = input("pleas enter a number: ") | |
try: | |
user_int = int(user_input) | |
if user_int > 0: | |
print("you just entered: {}".format(user_int)) | |
else: | |
print("it is not a positive number") | |
except ValueError: | |
print("it is not a number") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment