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

Maggie has $14,100 to invest, and wishes to gain $4,000 in interest over the next eight years. Approximately what is the minimum simple interest rate Maggie nee
Which part in this excerpt from Theodore Dreiser’s “My Brother Paul” reflects Dreiser’s desire for acceptance?
Exercise can help to lower blood cholesterol levels true or false
What was the initial result of the presidential election in 2000?
Critics write how they feel about a play. True or False?
the. sum of two consecutive. integers. is 17
Which part of a scientific argument must be supported by valid data?
Which one of the following required the majority of the electorate to take an oath before a state could be readmitted to the Union? Freedmen's Bureau Force Act
23% of a number is 46 what is the number?
The flapper was a style associated with both men and women. a. True b. False