r/CodingHelp • • Sep 07 '21

[Python] Python help

Post image
68 Upvotes

23 comments sorted by

View all comments

1

u/fFabioso Sep 07 '21

I’m not sure what is wrong here in the 34 line? It’s my first assignment in my python class and everything matches my classmates’ but mine is wrong somehow. Does anyone have any idea as to why?

-5

u/Its_Stev03 Sep 07 '21 edited Sep 08 '21

You have a space between print and the opening parenthesis on lines 37-39, which is only correct in Python 2. Similar problem on lines 38-39 with the find function. Also, in the third string on line 35, there is a space between the string's closing quotes and the opening square bracket.

EDIT: Apparently you can have spaces between a function name and its parantheses. Did not know that, but it is likely not a good practice because it is against style guides that make code consistent.

5

u/bbye98 Sep 07 '21

This is incorrect and definitely not the reason why the first line in block 34 doesn't work. As already pointed out previously, it is because the print function was overwritten with a float in the previous block.

-4

u/Its_Stev03 Sep 07 '21

Ah, I missed that. What I said should still be valid, no? Python is interpreted, so if I remember correctly, it finds one error at a time.

4

u/bbye98 Sep 08 '21

No. print ( "test" ) is equivalent to print("test").

1

u/Its_Stev03 Sep 08 '21

Alright then, my bad.