I’m new to Python and while trying to write a scrip that will keep asking questions about the user until the scrip gets FALSE,
I decided to check the scrip,of course it gave me an syntax error that told me the mistake was on the fifth lane, `a.
Now on that lane I tried to change the old value of a to a new value.
sadly, I can’t understand the mistake that I made, can some one please check it and explain me what went wrong ?
#!/usr/bin/python
print "Hello, I'm wilfred and I'm an Artificial Intelligencen"
a=str(raw_input("Do you want to be my friend? n"))
if a=="yes":
a=str(raw_input("Yey ! my first friend,what is your name?n"))
if a==str :
print "Nice name man!"
elif a==int :
print "bye!"
elif a=="no":
print "Well, nice to meet you anway, good bye now n"
3
Answers
Your line
A general structure for this kind of repeating loop is
You just need to indent the line. Your code should work fine. Keep learning python. It’s awesome!!!!
To further help with the test cases, I changed your string and int tests for you. “==” test is for value btw.