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

function form 5x-7y=14
what is 11.11 as a mixed number ?
what multiplies to -140 and adds to -31
Which three ordered pairs complete the table to give solutions of the equation y = x – 5? A. (–3, –2), (0, –5), and (3, 2) B. (–3, –2), (0, –5), and (3, –2)
PLEASE HELP I GIVE THANKS
what is a color wheel plz help
2/3 of what number is 16?
why do fractions need to have a common denominator before you add or subtract them?
If x = –1 and y = 2, what is the value of the expression 2x3 – 3xy ?
What is a gene? A. a section of a protein that codes for DNA B. the alternate version of a trait C. the visible trait in the F1 generation D. a section of D