F string formatting

Hi All

Below is my code from the “Challenge: Which is the most popular airport?” of Numpy course

dropoff_location_code_bool_jfk = taxi[:, 6] == 2
jfk = taxi[dropoff_location_code_bool_jfk,:]

jdf_count = jfk.shape[0]

dropoff_location_code_bool_lag = taxi[: , 6 ] == 3

laguardia = taxi[dropoff_location_code_bool_lag , :]

laguardia_count = laguardia.shape[0]

dropoff_location_code_bool_newark = taxi[: , 6 ] == 5

newark = taxi[dropoff_location_code_bool_newark , :]

newark_count  = newark.shape[0]

print(f"JFK {jdf_count}")

What I expected to happen:
Assuming that the python version is 3.8 (An update on upgrading our courses to new Python versions) the last line is a valid

What actually happened:
But it throws an error. I an the same code in my local environment and it works fine
Below is the error that I am getting

  File "<ipython-input-1-1f83a7c9b818>", line 20
    print(f"JFK {jdf_count}")
SyntaxError: invalid syntax

Thank you

Hi @deepak_dit2009,

Welcome to the Community! :balloon:

It seems that the process of the DQ transition to Python 3.8 is not finished yet, it is still ongoing (as it was mentioned also in this post). Indeed, if you run in your mission screen this code:

import platform

you will see that the version is still Python 3.4.3. This is the reason why on your local computer this code runs well and on the DQ platform throws (still) an error.

Hopefully this process of transition will be completed soon!

1 Like

This explains.Thank you so much

1 Like