Confundido con las converciones | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Confundido con las converciones

estremadamente confundido con la conversiĂłnes

14th Apr 2017, 5:18 PM
Jose Ricardo
Jose Ricardo - avatar
8 Answers
+ 3
english?
14th Apr 2017, 5:26 PM
Nihad TK
Nihad TK - avatar
+ 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'
14th Apr 2017, 6:07 PM
Nihad TK
Nihad TK - avatar
+ 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 ????
14th Apr 2017, 5:32 PM
Jose Ricardo
Jose Ricardo - avatar
+ 1
210 is a int but "210" is a str
14th Apr 2017, 6:37 PM
Nihad TK
Nihad TK - avatar
+ 1
@jose yes
14th Apr 2017, 6:46 PM
Nihad TK
Nihad TK - avatar
+ 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 ;)
17th Apr 2017, 7:58 AM
Ángel Daniel
Ángel Daniel - avatar
0
Since it is a (a string) and not?
14th Apr 2017, 6:14 PM
Jose Ricardo
Jose Ricardo - avatar
0
Ahhh everything is in the "", so the quotation marks are the ones that define whether or not it is string, am I correct?
14th Apr 2017, 6:45 PM
Jose Ricardo
Jose Ricardo - avatar