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

Neurons in the visual cortex respond to which type of stimulus?
This is the graph of a polygon. What is the approximate perimeter of the polygon?
Tell at least 5 facts about native americans during the revolutionary war
Select each correct answer. f(x) is a polynomial function. f(x) is an exponential function. g(x) is a polynomial function. g(x) is an exponential function. The
Please help me awnser this saskatchwan canada treaty
What are the coordinates?
How are the speaker and his friend like the "migrating birds" he mentions in line 12?
The perimeter of a rectangle is 12 meters. Find the maximum area of such a rectangle. You must support your answer with calculus; an answer without support will
Brody drives 180 km in two hours. How fast is he travelling? should be in km/hour)
Which types of cells form a cell plate during cytokinesis