“Python F Saiten” Code-Antworten

F Strings

var = 1
print(f'number {var}')
A DG

Python F Saiten

'''
In python, rather than adding pieces of string together, you can use
f-strings to insert variables into strings. This makes your code much
more easier to read.
'''

# OLD - WITHOUT F-STRINGS
name = 'Bob'
age = 12
print('This is ' + name + ', he is ' + age + ' years old.')

# NEW - WITH F-STRINGS
print(f'This is {name}, he is {age} years old') # Note the f in front
Ninja Penguin

Ähnliche Antworten wie “Python F Saiten”

Fragen ähnlich wie “Python F Saiten”

Weitere verwandte Antworten zu “Python F Saiten” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen