Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. import os
  2. clear = lambda: os.system('cls')
  3.  
  4. while 1:
  5.     usr_input = str(raw_input("To calculate the faculty of a given number\nenter a positive interger.\nEnter <0> to quit.\n> "))
  6.  
  7.     if (usr_input == "0"):
  8.         print "Good Bye!"
  9.         exit(1)
  10.     elif (usr_input != None):
  11.         result = 1     
  12.         for i in range(1, int(usr_input)):
  13.             result = result * i
  14.         print "Summary of the last calculation:\n\tGiven input: %d\n\tFaculty of input: %d\n" % (int(usr_input), result)
  15.     else:
  16.         print "You fucked up"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement