1 Replies - 498 Views - Last Post: 19 December 2013 - 11:21 AM Rate Topic: -----

#1 draftcopy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 21-February 10

Conditions & Control Flow: Lesson 13/15 in Codeacademy

Posted 19 December 2013 - 10:33 AM

Hello,

I'm teaching myself Python using Codeacademy's website. I ran into a problem and would like to know something. Is the following code complete or is it missing something? For the lesson, all you have to do is add "False" twice (line 7 and line 13). When I run the program, I don't receive a result and I am given the green light to move on. I think there is something wrong. Any help would be appreciated.

Thanks,
Christopher

[
1 answer = "'Tis but a scratch!"
2
3 def black_knight():
4 if answer == "'Tis but a scratch!":
5 return True
6 else:
7 return False
8
9 def french_soldier():
10 if answer == "Go away, or I shall taunt you a second time!":
11 return True
12 else:
13 return False
]

Is This A Good Question/Topic? 0
  • +

Replies To: Conditions & Control Flow: Lesson 13/15 in Codeacademy

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3197
  • View blog
  • Posts: 10,710
  • Joined: 12-December 12

Re: Conditions & Control Flow: Lesson 13/15 in Codeacademy

Posted 19 December 2013 - 11:21 AM

Please post your code again without the line numbers. You should by now know how to use the code tags:

Highlight your code and click the [ CODE ] button just above where you are typing your post. Press the Preview Post button until it is correct.

In the meantime, that code is incomplete because neither of the functions are called. Running the code will do nothing other than assign the variable answer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1