+ 2

[Python 3.6] Does Solo Learn Code Playground run f'string?

PyCharm suggested me to change print("{} e {}".format(a, b) to print(f"{a} e {b}") Well, I copied the code to SoloLearn and clicked run, but I got an error. Do you know what might have happened?

14th Mar 2018, 10:42 PM
Daniel Fernandes
Daniel Fernandes - avatar
4 Answers
+ 4
Aha...F-strings were introduced in 3.6; here it's: import platform print(platform.python_version()) 3.5.1 Here's the official intro +examples: https://www.python.org/dev/peps/pep-0498 You could request SoloLearn upgrade...
16th Mar 2018, 4:37 AM
Kirk Schafer
Kirk Schafer - avatar
+ 3
format() is supported, but what happened: It depends. What's the error message?
15th Mar 2018, 10:43 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Great! Thanks for this hint!
16th Mar 2018, 12:07 PM
Daniel Fernandes
Daniel Fernandes - avatar
0
When I try to use f-string in Solo Learn, I get the error : Invalid syntaxe Here is the line print(f"{a} and {b} are someone's favorite colors.")
16th Mar 2018, 3:43 AM
Daniel Fernandes
Daniel Fernandes - avatar