Created
January 12, 2012 06:45
-
-
Save delonnewman/1599096 to your computer and use it in GitHub Desktop.
This file contains 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
import random | |
class Friend: | |
def __init__(self, name, age=False): | |
self.name = name | |
if not age or age == True: | |
self.age = random.randint(1, 100) | |
else: | |
self.age = age | |
if self.age < 0 or self.age > 100: | |
print "Invalid Age. Please Enter an Age Between 1-100" | |
def show_name(self): | |
print self.name | |
def show_age(self): | |
print self.age | |
friend1 = Friend("Tod") | |
print friend1.name | |
print friend1.age | |
friend2 = Friend("Tim", 19) | |
friend2.show_name() | |
friend2.show_age() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment