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

What type of loan requires you to pay back the interest during college?
What can be done to identify barriers to building a loyal customer​ franchise?
Landholder who owned no slaves and lived in southern eastern foothills
Using the mass of the proton 1.0073 amu and assuming its diameter is 1.0×10−15m, calculate the density of a proton in g/cm3.
How did the puritans' distinctive religious outlook and church organization shape the politics, society, and culture of massachusetts bay and most of the other
Ann and Betty shared a sum of money in the ratio 2:3 Ann received $120 what was Betty's share
Are the stars in the sky a point, line, line segment, ray, or plane
Your small intestine can absorb ____ without any prior digestion into smaller molecules
During World War I, the increase in home gardens was an example of which of the following? campaigns to overcome shortages caused by ships being sunk civilian
What president was unable to achieve his political goals because of corruption?