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 is the square root of 789
help please 10 points
Find x and y if angle one is 2x+10 and angle two is 4y-30
The graph of the equation 2x2 + xy + y2 = 4 is the tilted ellipse pictured below; i.e. the points (x,y) in the plane that satisfy the equation yield the picture
Which of the following is greater than 4.3 x 10^9 a. 4.3 x 10^9 b. 3.2 x 10^9 c. 5.3 x 10^9 d. 7.4 x 10^8
Gary is catering a picnic. There will be 118 guests at the picnic, and he wants each guest to have a 12-ounce serving of salad How much salad should he make?
10 objectives to describe a roman emperor
conjunctions and prepositions can be interchanged. true false
which of the following is a characteristic of a line? its length can be measured it can be seen its width can be measured it is infinite in length
The igneous rock texture that is characterized by two distinctly different crystal sizes is called ____. Coarse-grained texture Fine-grained texture Glassy t