Share your repls and programming experiences

← Back to all posts
Timmy
ShadedFlame (23)

Formerly broken. Thanks to a bunch of helpful users its up and running!

---TIMMY---
Timmy is a simple response program. Just for fun...


Thanks to: Thehappysquid, SotoAyam, LOLinteresting, and others.

Commentshotnewtop
Thehappysquid (25)

@ShadedFlame I am so happy to see this working! good job!

JosiahKnisely (26)

"Timmy" only responds to very specific command or inserts. How can you even call it an A.I., @ShadedFlame?

JosiahKnisely (26)

The original title was A.I., @ShadedFlame.

ShadedFlame (23)

@JosiahKnisely Is it still called AI? Please don't fault me for something I already fixed

JosiahKnisely (26)

I'm not "faulting" you, @ShadedFlame, I'm telling you your errors. You should be more open to criticism.

CodeABC123 (211)

You used my name again!

Thehappysquid (25)

Is shaded flame even still a user? He didn’t show up when I invited him.

LOLInteresting (8)

@Thehappysquid He is, but he is not active I think

he did invite me to his python.

ShadedFlame (23)

@Thehappysquid Sorry about that yesterday got busy fast for me...

ShadedFlame (23)

@Thehappysquid Did you invite me to something? I didn't get anything...

Thehappysquid (25)

@ShadedFlame I did, sorry if you didn't receive it.

Thehappysquid (25)

I am fixing it, I will invite you

Thehappysquid (25)

You need to indent those if statements…. It won’t recognize v otherwise

SotoAyam (7)

I think I know what's wrong! This is what you did:

def main():
 v = input("Hi, I'm Timmy! Talk to me!\n")
if v ==  'what should I say':
           pz = ('Who are you?,Who made you?')
                   
else:
     pz = "You spelled something wrong, try again... Don't capitalize my name! also try variations on what your saying... I am very dumb... You have to say it perfectly!"
print(" " + pz + " ")
main()

main ()

When it should be this:

def main():
 v = input("Hi, I'm Timmy! Talk to me!\n")
 if v ==  'what should I say':
     pz = ('Who are you?,Who made you?')
                   
 else:
     pz = "You spelled something wrong, try again... Don't capitalize my 
     name! also try variations on what your saying... I am very dumb... 
     You have to say it perfectly!"
 print(" " + pz + " ")
 main()

main ()

You have to put a space in front of 'if', 'else', 'print' and the first 'main()'

holylemonaple (1)

br0, 1 g0tchu- 4ls0 T1mmy sp34ks l33t n0w

LOLInteresting (8)

Do you have repl.it discord? I can explain more there, but first of all, let me just fix the problem you are asking about: (I am rusty at Python now, so if I made any mistakes, please correct me)

if v == 'what should I say':
pz = ('Who are you?,Who made you?')
As user treeplate pointed out, you are basically running a lot of if loop at the same time, remember to change them to elif, and also, notice the fact that you have lined up your entire if statements with the define main(). Line them up buddy.

To see how it should work out, look at my forked version:
https://repl.it/@LOLInteresting/SeashellTepidRedundancy

DeBeast591 (126)

V is a local function, put the if statements in the main() function, then put a while True: main() loop to loop the main function.

treeplate (0)

https://SeashellTepidRedundancy.treeplate.repl.run has it fixed
EDIT: no, it still doesent work
For one, change your ifs to elifs

Thehappysquid (25)

@treeplate that was the problem beforehand

CodeABC123 (211)

Hey, my name is Timmy!

ShadedFlame (23)

@CodeABC123 Yeah I'm stalking you... Lol jk

IndyCarter (61)

It says there is an unexpected indent on line 54 :( @ShadedFlame

ShadedFlame (23)

@IndyCarter Yes there is... I have no idea what happend... Its glichy

ShadedFlame (23)

@IndyCarter Trying to... Everytime I fix one thing another pops up...

IndyCarter (61)

Put it in ask someone will know how to fix it @ShadedFlame

Thehappysquid (25)

Here is the bug I mentioned...

Thehappysquid (25)

@ShadedFlame , the answers don't seem to be working. If I may suggest, instead of using elif, you could use plain old if, and then have Timmy not respond at all to bad grammar.

LOLLIPOP06 (25)

getting nothin but syntax errors on line 7

LizFoster (157)

I found the "creep" bit. Almost reminds me of ハムマン (Lol) ⁀ᗢ⁀

However, you shouldn't call this AI, as the only answers it gives are pre-programmed; an AI would be able to formulate its own original answers based on user input

ShadedFlame (23)

@LizFoster Yes I'll change it... I'll just call it timmy

LizFoster (157)

@ShadedFlame Also, I see you've added elif gates for bad grammar and such. This is unnecessary, as you could simply specify for v:

v = input("Hi, I'm Timmy! You can talk to me, but please use proper grammar!\n")
ShadedFlame (23)

@LizFoster I wasted it to be able to take some bad grammer...

LizFoster (157)

@ShadedFlame While I can understand that, it makes the code look messier. One more change you should make:

  • Line 7 needs to be properly indented
Thehappysquid (25)

Why do you type USS Hammann? @LizFoster

Thehappysquid (25)

What about creep reminds you of a WW2 ship?

LizFoster (157)

@Thehappysquid WWWWWWWWWWWW

It's a reference to a game she's in (Lol)

LizFoster (157)

@Thehappysquid Because that was the reference I was making!

Thehappysquid (25)

I don't mean to be a critic, but this isn't really AI, as is is just a bunch of if statements. Also, you have a syntax error.

ShadedFlame (23)

@Thehappysquid Yes, maybe it was a bad choice of words to call it an AI... It is my first project...

Thehappysquid (25)

@ShadedFlame I appreciate you accepting that. Good job on the project!