Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Guessing program
- #def main -- program :D
- def main():
- #the actual values
- #Could also be set to global constants.
- realWeight = 190
- realAge = 27
- realName = 'bob'
- #the guessed variables
- guessWeight = input('Guess the weight: ')
- guessAge = input('Guess the age: ')
- guessName = raw_input('Guess the name: ')
- #essentially runs the modules
- getWeight = weightRight(guessWeight, realWeight)
- getAge = ageRight(guessAge, realAge)
- getName = nameRight(guessName, realName)
- #If name is right or not
- def nameRight(guessName, realName):
- if guessName == realName:
- print 'That is the right name!!!'
- elif guessName != realName:
- print 'That is not the right name :( '
- return nameRight
- #if weight is right or not
- def weightRight(guessWeight, realWeight):
- if guessWeight == realWeight:
- print 'That is the right weight'
- elif guessWeight != realWeight:
- print 'That is the wrong weight'
- return weightRight
- #if age is right or not
- def ageRight(guessAge, realAge):
- if guessAge == realAge:
- print 'That is the correct age!'
- elif guessAge != realAge:
- print 'that is not the correct age!'
- return ageRight
- #calls main
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement