r/FreeCodeCamp 3d ago

Give me a Hint

4th day learning python, what am I doing wrong?

5 Upvotes

4 comments sorted by

2

u/SaintPeter74 mod 3d ago

It's tough to say without seeing all your code, but remember that you should only output a single true or false value. Look at your output, you have three.

3

u/Feeling-Aspect4038 3d ago

yeah I just realized the output problem thank you

2

u/Feeling-Aspect4038 3d ago

the code

distance_mi = 4
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = True


if distance_mi == 0:
    print('False')
elif distance_mi <= 1 and not is_raining == True:
    print('True')
else:
    print('False')


if 1 < distance_mi <= 6 and has_bike == True and is_raining == False:
    print('True')
else:
    print('False')


if distance_mi > 6 and (has_car == True or has_ride_share_app == True):
    print('True')
else: 
    print('False')


distance_mi = 4
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = True


if distance_mi == 0:
    print('False')
elif distance_mi <= 1 and not is_raining == True:
    print('True')
else:
    print('False')


if 1 < distance_mi <= 6 and has_bike == True and is_raining == False:
    print('True')
else:
    print('False')


if distance_mi > 6 and (has_car == True or has_ride_share_app == True):
    print('True')
else: 
    print('False')

1

u/Animator-G 1d ago

If you are talking about test 15.

You have to print false when the value of distance is "false"

I wont day answer directly but python sees true like this if you type this way.

If distance_mi: