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

The largest tree in the world is the General Sherman sequoia in Sequoia National Park, California. It is 275 feet high, has a diameter of 36.5 feet, and has an
What causes a neap tide?
The two way table shows the number of students in a school who have cats and or dogs
Which of the following is a core benefit that content marketing can bring to a business's online presence?
Write the following equation in slope-intercept form. x/2 - y + 6 = 0 y = - x/2 - 6 y = x/2 + 6 y = x/2 - 6
f the pressure of a sample of gas is doubled at constant temperature, what happens to the volume of the gas?
I need to know the answers to at least 2 of these
Which expression is equivalent to
Which of the following objects would require the use of a small-scale model? A. An atom. B. The planet Saturn. C.The highway system in Florida. D. The path of
What is the greatest hindrance to New Mexico's economy and prevents population growth?