Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
Confundido con las converciones
estremadamente confundido con la conversiĆ³nes
8 Respostas
+ 3
english?
+ 2
here '210'(a string) is multiplied by 2(a integer)
so answer would be 210210
but we used float so the answer became
210210.0
example hi(a string) is multiplied by 3(a integer)
answer is 'hihihi'
+ 1
I do not understand the conversations in the example. Neither the 210 * 2, the answer is not 420? Why is the 210210.0 response ????
+ 1
210 is a int but "210" is a str
+ 1
@jose yes
+ 1
Si por ejemplo, haces un programa que multiplique un nĆŗmero por otro que diga el usuario, necesitarĆ”s recoger el otro nĆŗmero usando input. Hasta ahĆ todo bien.
Pero despuĆ©s, cuando lo multipliques, te va a dar error, ya que input registra el nĆŗmero como una string. Por eso necesitas convertirlo a int antes de multiplicar con el otro int para que funcione.
Y si en lo que tienes dudas es en quĆ© hace cada cosa, aquĆ dejo una lista:
int (integrer)-->un nĆŗmero entero: 1, 2, 3, 4, 5, 6, 7, ... infinito
str (string)-->una palabra, aunque contenga nĆŗmeros. El caso es que un string es registrado como texto: "hola", "tengo 3 gatos", "etc."
float (floats)--> Esto es igual que integrers, solo que en este tipo de variables tambiĆ©n te registra los nĆŗmeros decimales. Es Ćŗtil cuando quieres obtener resultados exactos: 7/3, 3.14, 7.0... etc.
Y esto es lo bĆ”sico, espero que asĆ lo entiendas
Por cierto, soy espaƱol, asĆ que comentame cualquier cosa si lo necesitas ;)
0
Since it is a (a string) and not?
0
Ahhh everything is in the "", so the quotation marks are the ones that define whether or not it is string, am I correct?