anonymous
  • anonymous
Hi i am wondering what i did wrong here- def ask() : answer = raw input("Do you wish to tell me about your favorite desert?") If (answer == 'yes' ) : print ("Next i will ask you about your favorite desert") Print ("now i will tell you about your clasess favorite desert")
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
MattC
  • MattC
you have a few syntax errors, raw input has to be raw_input, you can not capitalize if or print.
MattC
  • MattC
you can see syntax errors when you try and run the program, they should highlight in red, and as you fix each error it will point out another.
anonymous
  • anonymous
Thanks for the help

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
i have a syntax error that im not sure how to resolve If (answer == 'yes' ) : print ("Next i will ask you about your favorite desert") The colon is the line is having a syntax problem and im not sure what is wrong, thanks
MattC
  • MattC
the i is capitalized in if
anonymous
  • anonymous
yeah it is, but im getting a snytax eorr on the colon
MattC
  • MattC
where it points unfortunately is not always 100% accurate, its close but the error may be somewhere else on that line or even another place entirely, python is case sensitive.
MattC
  • MattC
so it will not recognize If,Else,Return it will recognize if, else, return
anonymous
  • anonymous
ok i fixed the syntax, now when i go to run the module it will run and nothing happens (im a beginner)
anonymous
  • anonymous
im not sure if i just need to add something to the end of the script,
MattC
  • MattC
so now you have a working program. cool but what you have written so far is a function. A function will not do anything unless you have called it somewhere. you can simply call it by typing ask() anywhere after the function has been defined. So you can not call ask() before you have defined the function ask(), later on in this course there are instances where a function will call itself within itself. Dont worry about that yet.
anonymous
  • anonymous
>>> >>> ask () Do you wish to tell me about your favorite desert?yes Next i will ask you about your favorite desert Traceback (most recent call last): File "", line 1, in ask () File "C:\Python25\fixedhw.py", line 4, in ask Print ("now i will tell you about your clasess favorite desert") NameError: global name 'Print' is not defined This is the error im getting when i call the function
MattC
  • MattC
its another syntax error, try and find out what it is, and if you still need help let me know
anonymous
  • anonymous
ok i found it, thank you very much youv been a great help, now im wondering about this, i am trying to mkae the program do=that asks the user whether they wish to tell which is their favorite dessert, or they wish to find out what other's favorite dessert is. Now when i do that i prints both the lines at the end regardless if they say yes or no, so im wondering how to seprate them and make it only print depending on the awnser the user gives.
MattC
  • MattC
take a look at this. http://docs.python.org/tutorial/controlflow.html
anonymous
  • anonymous
ok perfect, thanik you very much. i might be back with more questions :) but thanks for now
MattC
  • MattC
your welcome

Looking for something else?

Not the answer you are looking for? Search for more explanations.