print('We use this as a locking mechanism...')
class kyle:
name="xxxx xxxx"
age="18"
dob="08.17.19xx"
eye="brown"
hair="brown"
skin="white"
def soci(self):
ans=input('what is your street name? ')
if ans == "jaxel":
print('xxx-xx-xxxx')
else:
print('incorrect')
obj=kyle()
name=obj.name
age=obj.age
dob=obj.dob
eye=obj.eye
hair=obj.hair
skin=obj.skin
soci=obj.soci()
print('')
print('to see name type "name"')
print('to see age type "age"')
print('other options: "dob", "eye", "hair", "skin", "soci"')
while 1==1:
task=input('What features about Kyle would you like to view? ')
if task == 'name':
print(name)
elif task == 'age':
print(age)
elif task == 'dob':
print(dob)
elif task == 'eye':
print(eye)
elif task == 'hair':
print(hair)
elif task == 'skin':
print(skin)
elif task == 'soci':
soci
else:
print('what are you trying to say?')
#
#
#
I made this to test my knowledge of classes. What is wrong with it?
Started by Kyle Snavely, Sep 25 2011 03:42 PM
1 reply to this topic
#1
Posted 25 September 2011 - 03:42 PM
I understand that there is 50+ easier ways to make a simple data base program like this but I did it to test my knowledge of classes so far. When I run the program nothing happens, it shows restart than I get a bar that I can't type in... Also I said the locking method thing as a cover up. but forsomereason the first thing the program does is ask for my street name? soo... any help would be appreciate. I am having a hard time understand what parameters return and how they return them. thanks again!
|
|
|
#2
Posted 28 September 2011 - 10:25 AM
You're getting this behavior because of the soci=obj.soci() code on line #24. You're asking Python to prompt the user here.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









