3 ms·
nope it should be print(f"Howdy {x}") It's a new python 3.6 feature called f-strings/string interpolation https://docs.python.org/3.6/reference/lexical_analy
by rat87 10y ago
nope it should be
print(f"Howdy {x}")
It's a new python 3.6 feature called f-strings/string interpolation
https://docs.python.org/3.6/reference/lexical_analysis.html#f-strings https://docs.python.org/3.6/reference/lexical_analysis.html#...
That said in python3 print is a function not a statement and requires parenthesis so he still has a typo.
- pmontra 10y agoI know f-strings but I still can't believe them. There are parts of Python that look like it wants programmers do low level compiler job and I can't understand why. This is one of them. Python can do %s string interpolation without some s'' s-strings so I wonder why it needs this f-string thing. Many languages can do string interpolation without having developers babysitting the interpreter. In 2016 we have the CPUs to make it happen the other way around.
- rat87 10y agoIt has to do with backwards compatibility in syntax if they had been smart enough to introduce in python3 they could have done it without the f.