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

The Run is the ___ Change between two points on a line
How many families have at least 4 pets?
Quick, anyone know the answer to this English question?
Matthew throws a ball straight up into the air. It rises for a period of time and then begins to drop. At which points in the ball's journey will gravity be the
Read the excerpt from "Benin Plaque: The Oba with Europeans.” The Portuguese galleons, cutting out all the middlemen and able to carry much bigger cargoes, off
The area of a square can be found using the equation A= s2, where A is the area and S is the measure of one side of the square. Match the equation for how to sl
find the length of the missing side. if necessary, round to the nearest tenth. A. 44B. 22C. 15.6D. 484​
When was the nurse’s daughter born in Romeo and Juliet?
Sally’s dog boarding service currently has 2 Great Danes, 8 golden retrievers, 22 mastiffs, and 12 Doberman pinschers. What is that ratio of Doberman pinschers
A cyclist travels at a constant velocity of 3.2m/s westward, then speeds up with a steady acceleration of 2.3m/s^2. Calculate the cyclist’s speed after accelera