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

Can someone please help?? In right ∆LMN, sin M = 0.759. What is cos N? A) 0.121 B) 0.241 C) 0.349 D) 0.651 E) 0.759
Tim does a study to determine whether or not cigarette smoking decreases speed in track runners
How do you describe a neuron?
Which answer is correct?
Directed pressure causes
What did Spain do after the American Revolution to discourage American settlements west of the Appalachian Mountains? A. Spain placed a heavy tariff on Americ
Locke’s belief in the social contract between a government and its people meant thatLocke’s belief in the social contract between a government and its people me
como chamamos a américa na divisão cultural ?
The current in a certain circuit as measured by an ammeter is a continuous random variable X with the following density function: f(x) = {.75x + .2 | 3=
learning is most likely to empower you and enhance your life when you