0
AI practice with error
I start the AI practice ask me to define this correctly: height = print( *2) I complete this height = input() print(heigth*2) And score me correct! ??? But is not correct inputs are strings and 2 is a number and is not possible multiple strings with number... at least a the very beginning of the course.
3 Answers
+ 4
First of all at the print line you have written heigth and not heightâŠ
Second, you CAN multiply strings with number in python.
Examples:
âHiâ * 3: âHiHiHiâ
print(âhello\nâ * 100) # prints 100 times âhelloâ in the console.
Do you understand?
+ 3
Te lo digo en español:
Has puesto heigth y no height en la lĂnea del print. Eso conllevarĂĄ un error.
Segundo, sĂ que puedes multiplicar strings por un nĂșmero en python.
Ejemplos:
âHola!â * 3 devuelve âHola!Hola!Hola!â
Otro ejemplo:
âQue tal?\nâ * 2 devuelve:
Que tal?
Que tal?
Recuerda que \n es un caracter de escape que se usa para producir una nueva lĂnea.
print(âhello\nâ * 100) devuelve 100 lĂneas en las que pone âhelloâ.
Espero que esto te ayude ;)
+ 3
I failed to comprehend your message. Nonetheless, it is imperative that you transform the string input into a numeric data type, either by invoking the int() or float() functions, prior to engaging in any mathematical manipulations.