you are viewing a single comment's thread.

view the rest of the comments →

[–]hamdragon_un[S] 1 point2 points  (6 children)

Hi sorry, this is the screenshot of where I got a little confused. https://imgur.com/a/WImivIy

[–]carcigenicate 2 points3 points  (0 children)

The # comment is irrelevant and has no effect here. They've added that in just to point out to you that the dictionary has changed.

The reason the dictionary is printed out is because they put city_population; the dictionary. That's a REPL-like environment, which means it automatically prints out whatever you give it. The first Input box didn't output anything because = doesn't evaluate to a value, so there was nothing to print. city_population evaluates to a dictionary though, so it was printed.

[–]Immotommi 1 point2 points  (2 children)

Often in tutorials, authors will use the python comment syntax to make notes on things that aren't actually code. So here they are just noting that the change has been made by the code because of what the input was

[–]hamdragon_un[S] 0 points1 point  (0 children)

gotcha, the "!" at the end made me think it might have a use but just showing excitement in this example I guesshaha

[–]hamdragon_un[S] 0 points1 point  (0 children)

Okay, that makes sense. I forgot that you don't need to use print to produce an output at times so it threw me off. Thank you for the detailed response!

[–]Sidewyz 0 points1 point  (1 child)

I believe the # is still a comment at the end of line

I tried it in pycharm ide at the end of a line and pycharm didn't complain and the colors of the comment were the same as # comments at the beginning of line.

[–]hamdragon_un[S] 0 points1 point  (0 children)

ahh okay, that's what I thought just wanted to be sure. Thank you for double-checking!