Advertisement
Fhernd

number_to_name.py

Sep 27th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. def number_to_name(number):
  2.     # Convert a number to its corresponding name of the choice.
  3.    
  4.     # Check the input number:
  5.     if (number == 0):
  6.         return 'rock'
  7.     elif (number == 1):
  8.         return 'Spock'
  9.     elif (number == 2):
  10.         return 'paper'
  11.     elif (number == 3):
  12.         return 'lizard'
  13.     elif (number == 4):
  14.         return 'scissors'
  15.     else:
  16.         return -1 # An invalid number has been entered.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement