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

Why would a freedman agree to become a sharecropper?
The barrel of a gun is also known as what? Rifle Caliber Bore Gauge
how many feet does 5 yards equal
what is the equivalent to 7.4 kilograms
The complex numbers corresponding to the endpoints of one diagonal of a square drawn on a complex plane are 1 + 2i and -2 – i. What are the complex numbers cor
The Sino-Japanese War exposed military weakness in A. China. B. Japan. C. Korea. D. Russia.
How did the issue of slavery divide the union
A skier needs to buy new ski poles during a ski trip to Utah. The price of the poles is $24 and the sales tax is 4.7%. What is the total cost of the poles, roun
which term describes an enzyme
What important decisions had to be made concerning the fate of the seceded states and the rights of those freed from slavery?