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

To punish is to _____ize someone. Change the middle letter. The word before is pedal.
Which phrase best describes the “cause” that Paine refers to
how has the roman invasion of Britain changed the country
what does a habitat and a niche have in common
Which sentence does not contain any errors in comma usage. A.Mr.Morrish my new scout master, is from lreland. B.Suzie, my best friend, is also an amazing athlet
Why did the Mexican government encourage American settlement in Mexico in the early 1820s
Which phrase best describes the “cause” that Paine refers to
what PEMDAS is this (4+5)78-49
what happened to the colonists who opposed the Declaration of Independence
What is evolution? A. A measure of the relative survival and reproductive success of an individual B. A cumulative change in the genetically controlled characte