0

Working on mario (more).py port into python. My code works and it seems to output the correct things, but check50 does not like it. Can anyone point me in the right direction of where I am incorrect?

  • Post your code, select it, and either click the {} button in the editor or press Ctrl+K. Indentation is very important in Python, and code with incorrect indentation could mean anything. – Blauelf Dec 12 '17 at 17:21
  • @Blauelf Just edited. Thank you! – q0w9e8r7t6y5 Dec 12 '17 at 17:25
  • That's not your code. The outer loop should be at a different indentation level than the inner loops. – Blauelf Dec 12 '17 at 17:27
  • @Blauelf I apologize for the confusion. Figured out how to properly display it now! – q0w9e8r7t6y5 Dec 12 '17 at 17:35
0

Hint: How many spaces should be between the two half-pyramids? (check50's output won't show you how many you print or are supposed to print, it always shows one)

You should really look into the * operator for lists and strings. For example, "123" * 3 would result in the string "123123123". [42] * 4 would result in a list [42, 42, 42, 42].

That way, and with string concatenation operator +, you can have a single print statement in your for loop, and no inner loops.

| improve this answer | |
  • According to the specification, there should be two spaces between the two half-pyramids, which is what I tried to do in my code – q0w9e8r7t6y5 Dec 12 '17 at 17:38
  • Have you tried your code yourself? Use an n larger than 1. – Blauelf Dec 12 '17 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .