autumnnicole36582
autumnnicole36582 autumnnicole36582
  • 03-03-2021
  • Computers and Technology
contestada

Do you think we could use mathematical operators on string values rather than integers or floats? Explain.

Respuesta :

60002135330 60002135330
  • 03-03-2021

Answer:

Yes and no. For example, you can do this:

print('hi' * 5)

Output:

hihihihihi

HOWEVER, you cannot do mathematical operations on strings. If I have a string "6" and try dividing it by 3, it's not going to work because... it's not an integer. While multiplying strings does work, you cannot actually do real math with strings unless you change them to int or float

Answer Link

Otras preguntas

Energy that does not involve the large-scale motion or position of objects in a system is called: A- Kinetic Energy B- Potential Energy C- Nonmechanical Energy
A 500 watt vacuum cleaner is plugged into a 120 volt outlet and used for 30 minuets. How much current runs through the vacuum?
Answer this question
rite five sentences comparing things in your school today versus how they were when you were a child.
Use the distributive property to factor the expression below. 54x2y - 12x2y2
Which of the following demographic changes contributed to the rise of conservatism?
In legal challenge to the affordable care act, the supreme court ruled that
Evaluate: 8.25 ÷ 0.15
3.75 g of an unknown gas at 29 °C and 1.10 atm is stored in a 1.75-L flask. What is the density of the gas? What is the molar mass of the gas?
"in any given year, the most common type of psychological disorder is:"