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

During world war ii how were resources preserved for the war effort
X over five equals three over four
Select all that apply. Identify which element(s) should not be included in a resumé. business letter format education/training contact information objective emp
The diagram below shows the dimensions of a triangular park built in a new housing development. Two side lengths and one angle measure are given. What is the me
Out of 1,100 discs tested, 13 are defective. Estimate the number of defective discs in a batch of 41,000. Question 2 options:
Why do you think long periods of moderately intense sunlight is ideal fo beta vulgaris
Choose the best description for the real number 34 over 3. Irrational, because it is a fraction Irrational, because it is a repeating decimal Rational, becau
Order the set of numbers from least to greatest.
bonnie had 6 bags of 6 gel pens. she wanted to give the same number of gel pens to 9 friends. how many gel pens did each friend get?
Consider the system of inequalities and its graph. y ≤ –0.75x y ≤ 3x – 2