¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 15 de 24 · Texto

Arithmetic operators: multiplication and division

David Khieu

Arithmetic operators: multiplication

An * (asterisk) sign is a multiplication operator. 

Run the code below and check if our integer vs. float rule is still working. 

print(2*3)
print(2*3.)
print(2.*3)
print(2.*3.)

It is.

Arithmetic operators: division

a / (slash) sign is a divisional operator.

The value in front of the slash is a dividend, the value behind the slash, a divisor.

Run the code below and analyze the results. 

print(6 / 3)

print(6 / 3.)

print(6. / 3)

print(6. / 3.)

You should see there is an exception to the rule. 

The result produced by the division operator is always a float, regardless of whether or not the result seems to be a float at first glance: 1 / 2, or if it looks like a pure integer: 2/1 

It this a problem? Yes, ti is. It happens sometimes that you really need a division that provides an integer value not a float. 

Fortunately , PYthon can help you with that. 

 

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?