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's the algebraic expression of "15 less than a number squared"?
What is the lcm of two numbers that have no common factors greater than 1?
a number is k units to the left of 0 on the number line. describe the location of its opposite.
800 is 10 times as much as_____
For what reason was the "Union Party" created? Who were its candidates?
67.943 in expanded form
is -n always sometime or never a positive number ?explain
is 7 over 9 , 5 over 12, and 5 over 8 terminating or repeating decimals? and what are they in decimals? please explain..thx :)
Can someone help me ?????
What's the algebraic expression of "4 times a number cubed decreased by 7"?