Well, I actually succesfully completed my first complete program in python, and I didn't use the forum for help, I stuck it out and figured it out on my own. After spending about two and a half hours getting all these make shifts loops right, I feel pretty darn good about it. Although I still feel it could be better. But hey, I guess that's what version 1.5 or so is for, right? Not that anybody would ever need (or want) another one of these. Well, here it is, I haven't figured out how to make it executible with py2exe yet. Still, I am kinda proud of it.

# trying to learn about assinging values
# this is start
def part_one():
    print '''Hello. My name is Shadow, I am the programmers late
    pet cockatiel.'''
    name = raw_input("What's your name?")
    print "Hello,", name, "what's up?"
    answer1 = raw_input()
    print "Well,", name, '''seems like you could be doing more
    than''', answer1, "don't you think?"
    print "Do you have any friends?"
    friends = raw_input().lower()
    if friends == "yes":
        part_two()
    elif friends == "no":
        print "Yeah I figured that much."
        part_two_a1()
    else:
        print "Come on, it's a yes or no question, DUDE!"
        friends()
# if you tell shadow yes you have friends
def part_two():
    print "So, you actually have friends? Give me a name then!"
    name = raw_input("I bet your lying, give me a name!")
    print "Hah, I knew it!", name, "tried to give me $10 to be his friend!"
    print "What a loser! Hey, at least I got $10!"
    age = float(raw_input("So, how old are you?"))
    print age, "Hah, I am ", age * 9, "centuries older than you!"
    if age < 18:
        print "I think you beat my son up in school!"
        grade = float(raw_input("What grade are you in, punk?"))
        print  grade, "! So was my son!"
        print "Till he asked to be homeschooled cuz YOU call him names!"
        part_three_a2()
    else:
        print "Hay, now I remember you!"
        print "You used to beat up my son on his way to school!"
        print "And call him names! You ", age, "year old pooper scooper!"
        part_three_a()
# if you tell shadow no you don't have friends
def part_two_a1():
    print "I knew it all along!"
    mean_names = raw_input("What did you call me, I heard that you stupid face, you bully!")
    print "Yeah, your mom's  ", mean_names, "too!"
    again = raw_input("")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    print  "But I'm still going to tell my mother on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_four()
# after you tell hubby no you don't got friends
def part_two_b2():
    print "I knew it all along!"
    mean_names = raw_input("What did you call me, I heard that you stupid face, you bully!")
    print "Yeah, well your moms  ", mean_names, "too!"
    raw_input()
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input("And what, sissy girl?")
    print  prompt, "!? Anyways, your just a sissy girl! My son can deal with you."
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_six()
# after you tell moomy no you don't got friends
def part_two_a():
    print "I knew it all along!"
    mean_names = raw_input("What did you call me, I heard that you stupid face, you bully!")
    print "Yeah, well your moms  ", mean_names, "too!"
    raw_input()
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input("And what, sissy girl?")
    print  prompt, "!? Anyways, your just a sissy girl! I'm telling my husband on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_five()
# after you say yes to hubby about having friends
def part_two_d():
    print "So, you actually have friends? Give me a name then!"
    name = raw_input("I bet your lying, give me a name!")
    print "Hah, I knew it!", name, "tried to give me $10 to be his friend!"
    print "What a loser! Hey, at least I got $10!"
    age = float(raw_input("So, how old are you?"))
    print age, "Hah, I am ", age * 9, "centuries older than you!"
    if age < 18:
        print "I think you beat my son up in school!"
        grade = float(raw_input("What grade are you in, punk?"))
        print  grade, "! So was my son!"
        print "Till he asked to be homeschooled cuz YOU call him names!"
        part_three()
    else:
        print "Hay, now I remember you!"
        print "You used to beat up my son on his way to school!"
        print "And call him names! You ", age, "year old pooper scooper!"
        print
        print
        print
        print
        print
        print
        print
        print
        print
        print
        print "60 seconds later"
        print
        print
        print
        print
        part_six()
# after yuo tell hubby your age is less that 18
def part_three():
    print "I knew it all along!"
    mean_names = raw_input("What did you call my son you bully?")
    print "Yeah, well your  ", mean_names, "too!"
    again = raw_input("Now what ya got knucka?")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input()
    print  prompt, "!? I'll let my son deal with this!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_one()

# if you tell shadow your age is less than 18
def part_three_a2():
    print "I knew it all along!"
    mean_names = raw_input("What did you call my son you bully?")
    print "Yeah, well your  ", mean_names, "too!"
    again = raw_input("Now what ya got knucka?")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input()
    print  prompt, "!? I'm going to tell my mommy on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_four()
# if you tell shadow your age is not less than 18
def part_three_a():
    print "I knew it all along!"
    mean_names = raw_input("What did you call my son you bully?")
    print "Yeah, well your  ", mean_names, "too!"
    again = raw_input("Now what ya got knucka?")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input()
    print  prompt, "!? I'm going to tell my mommy on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_four()
# after you tell shadow no to friends and after he goes to tell mommy
def part_four():
     print '''Hello. My name is Storm, I am the programmers late
    pet cockatiel's mother.'''
     name = raw_input("What's your name?")
     print "Hello,", name, "did you call my son names? What did you call him?"
     answer1 = raw_input()
     print "Well,", name, '''seems like you could be doing more
    than calling my son ''', answer1, "don't you think?"
     print "Do you have any friends?"
     friends = raw_input("Well...").lower()
     if friends == "yes":
        part_two_y()
     elif friends == "no":
        print "Yeah I figured that much."
        part_two_a()
     else:
        print "Come on, it's a yes or no question, DUDE!"
        friends()
def part_two_y():
    print "So, you actually have friends? Give me a name then!"
    name = raw_input("I bet your lying, give me a name!")
    print "Hah, I knew it!", name, "tried to give me $10 to be his friend!"
    print "What a loser! Hey, at least I got $10!"
    age = float(raw_input("So, how old are you?"))
    print age, "Hah, I am ", age * 9, "centuries older than you!"
    if age < 18:
        print "I think you beat my son up in school!"
        grade = float(raw_input("What grade are you in, punk?"))
        print  grade, "! So was my son!"
        print "Till he asked to be homeschooled cuz YOU call him names!"
        part_three_a2b()
    else:
        print "Hay, now I remember you!"
        print "You used to beat up my son on his way to school!"
        print "And call him names! You ", age, "year old pooper scooper!"
        part_three_a2c()
# after you tell mommy your age is less than 18 she tells her hubby
def part_three_a2b():
    print "I knew it all along!"
    mean_names = raw_input("What did you call my son you bully?")
    print "Yeah, well your  ", mean_names, "too!"
    again = raw_input("Now what ya got knucka?")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input()
    print  prompt, "!? I'm going to tell my hubby on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_five()
# after you tell mommy your age is not less than 18 and she tells her hubby
def part_three_a2c():
    print "I knew it all along!"
    mean_names = raw_input("What did you call my son you bully?")
    print "Yeah, well your  ", mean_names, "too!"
    again = raw_input("Now what ya got knucka?")
    print "Oh yeah, well I'm rubber your glue, all that you say bounces off me..."
    print "And sticks onto you! HAHA sucker!"
    prompt = raw_input()
    print  prompt, "!? I'm going to tell my hubby on you!"
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print
    print "60 seconds later"
    print
    print
    print
    print
    part_five()
# after mommy gets hubby
def part_five():
    print '''Hello. My name is Bubba, I am the programmers late
    pet cockatiel's mother's ex-con husband.'''
    name = raw_input("What's your name?")
    print "Hello,", name, "did you call my wife names? What did you call her?"
    answer1 = raw_input()
    if "slut" in answer1:
        print "That she is..."
        print "Anyways...."
        prompt_five_a()
    else:
        prompt_five_a()
# after you tell hubby what you called mommy
def prompt_five_a():
    print '''Well, seems like you could be doing more
    than calling my wife that dont you think?'''
    print "Do you have any friends?"
    friends = raw_input("Answer me, doll").lower()
    if friends == "yes":
       part_two_d()
    elif friends == "no":
       print "Yeah I figured that much."
       part_two_b2()
    else:
       print "Come on, it's a yes or no question, DUDE!"
       friends()
       print "Well, either way, I'll let you work this out with Shadow."
       part_one()
# after you tell hubby no to friends, he decides to go get his son
def part_six():
    print "Either way, I'm gonna let yuo work this out with Shadow."
    print
    part_one()
part_one()

Recommended Answers

All 9 Replies

Must be your first attempt at ELIZA type AI.
The function friends() is called, but does not exist. What is it supposed to do?

i thought that by using friends() i could repeat the friends = raw_input(string).

friends = raw_input().lower() # I guess friends() doesn't call this?
    if friends == "yes":
        part_two()
    elif friends == "no":
        print "Yeah I figured that much."
        part_two_a1()
    else:
        print "Come on, it's a yes or no question, DUDE!"
        friends()

not too shabby for a first program:cheesy:

quick tip, instead of having 30 print statements lined up try something like this:

print "\n"*30

Oh no, friends() is a function call! You would have to do something like this ...

def friends():
    friends1 = raw_input().lower() # I guess friends() doesn't call this?
    if friends1 == "yes":
        part_two()
    elif friends1 == "no":
        print "Yeah I figured that much."
        part_two_a1()
    else:
        print "Come on, it's a yes or no question, DUDE!"
        friends()

I would be careful with mixing functions and variables with the same name! They compete for the same unique key within the Python interpreter internal dictionary! So I changed variable friends to friends1.

Member Avatar for Mouche

i thought that by using friends() i could repeat the friends = raw_input(string).

Nope, this doesn't work. The input given by the user is put into the variable friends. The "raw_input" tells the program to get input. You'd need a function such as the following for friends():

def friends():
    friends = raw_input("Do you have any friends? ").lower()
    if friends == "yes" or friends == "y":
        return 1
    elif friends == "no" or friends == "n":
        return 0
    else:
        friends()

friends = friends()
if friends == 1:
    friends_names = raw_input("Who are your friends? ")
    print "Oh, I know them."
else:
    print "HAHAHAHAHA. YOU HAVE NO FRIENDS!"

I hope that helped.

Oh, and very nice program. =D

Just a friendly reminder to LaMouche ...

I would be careful with mixing functions and variables with the same name! They compete for the same unique key within the Python interpreter internal dictionary! So I changed variable friends to friends1.

Answer the question with 'maybe' and you find an error in the call to friends(), friends has become a string variable to Python, which is not callable.

Member Avatar for Mouche

Oh right. Sorry to demonstrate bad techniques.

hey, thanks for the clarification anyways, la mouche! I can't believe I actually didn't realize that. So, does that mean that I would have to repeat the firends = raw_input? That would reset the definition of friends wouldn't it?

Member Avatar for Mouche

you just use friends() and either reassign it to the same variable or use another variable... it would run your code again and assign 1 or 0 to whatever variable you assigned the function to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.