“Strings Python F.” Respostas de código

f Strings

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

Strings Python F.

'''
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

Respostas semelhantes a “Strings Python F.”

Perguntas semelhantes a “Strings Python F.”

Mais respostas relacionadas para “Strings Python F.” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código