Tipos de dados int e float (números)
This commit is contained in:
21
aula4.py
Normal file
21
aula4.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Tipos int e float
|
||||||
|
# int -> Número inteiro
|
||||||
|
# O tipo int representa qualquer número
|
||||||
|
# positivo ou negativo. int sem sinal é considerado
|
||||||
|
# positivo.
|
||||||
|
# print(11) # int
|
||||||
|
# print(-11) # int
|
||||||
|
# print(0)
|
||||||
|
|
||||||
|
# float -> Número com ponto flutuante
|
||||||
|
# O tipo float representa qualquer número
|
||||||
|
# positivo ou negativo com ponto flutuante.
|
||||||
|
# float sem sinal é considerado positivo.
|
||||||
|
# print(1.1, 10.11)
|
||||||
|
# print(0.0, -1.5)
|
||||||
|
|
||||||
|
# A função type mostra o tipo que o Python
|
||||||
|
# inferiu ao valor.
|
||||||
|
print(type('Otávio'))
|
||||||
|
print(type(0))
|
||||||
|
print(type(1.1), type(-1.1), type(0.0))
|
||||||
Reference in New Issue
Block a user