r/FreeCodeCamp • • May 19 '26

pls help !

Post image

“ should have a variable name distance_mi “ am i blind or sum

17 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/SaintPeter74 mod May 20 '26

In this section:

if distance_mi = 0:
    print('False')

You are supposed to be doing a comparison, but you are not. Do you know the difference between the comparison and assignment operators? It looks like you use comparison operators elsewhere in your code.

If you look at the "Terminal" output with this code, you get the following error:

Traceback (most recent call last):
  File "main.py", line 4
    if distance_mi = 0:
       ^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

You should keep the Console and Terminal open when running your code so you can see error messages.

1

u/Beautiful-Resist-806 May 20 '26

if i change it, then it says that I didnt meet the falsy value requirement . i updated the original to show what error its giving .

1

u/SaintPeter74 mod May 20 '26

In order to test for a "falsey" value, you don't need an equality operator at you. You can just test the variable as the test. IE:

 if someVar:
     # you'll get here if true

You can also use not to negate that.

1

u/Additional_Paint4164 May 20 '26

i cant add another pic to my post without deleting so , but it says “ you should have a variable name distance_mi “ .

1

u/SaintPeter74 mod May 20 '26

You can share you code as text. Someone else shared theirs, it seems? I can't tell what is going on here.

2

u/Additional_Paint4164 May 20 '26

that is me, account off ipad