autumnnicole36582
autumnnicole36582 autumnnicole36582
  • 03-03-2021
  • Computers and Technology
contestada

How do you think we could print a sentence that uses a variable along with other text (ie: “My name is Joe” where ‘Joe’ is a variable called name.)

Respuesta :

60002135330 60002135330
  • 03-03-2021

This is for Python

name = 'Joe'

print(f'My name is {name}')

This is called string formatting. Using f before the text. This is another way

name = 'Joe'

print('My name is', Joe)

But I found that string formatting is cleaner and much more useful

Answer Link

Otras preguntas

at what point do scientists classify an area's weather as its climate? 1 year ,5 years ,15 years or 30 years
Write in function form X+y=6..?
What is the 50th term of the arithmetic sequence 4, 10, 16, 22, … ? Can someone explain this one?
which organism would more closely resemble it's parent,one produced by asexual reproduction,or one produced by sexual reproduction? why?
Propane and oxygen react according to the equation: C₃H₈(g) + 5O₂(g) → 3CO₂(g) + 4H₂O(g). How many grams of water can be produced from the complete combustion o
does a solution have to involve a liquid? explain.
WHICH EXPRESSION IS EQUIVALENT TO SIN 22 COS 18 + COS 22 SIN 18?
During the evolution of life on Earth, the photosynthetic organisms initially responsible for raising atmospheric oxygen concentrations from less than 1 percent
Factor the polynomial 6b^2-17b+10
Mrs.Savin receives a weekly base salary of $500,plus a commission of $1200 on each car that she sells. Write a function rule relating her total weekly pay p to