Confundido con las converciones | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Confundido con las converciones

estremadamente confundido con la conversiĆ³nes

14th Apr 2017, 5:18 PM
Jose Ricardo
Jose Ricardo - avatar
8 Respostas
+ 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