image

Acesse bootcamps ilimitados e +650 cursos

50
%OFF
Article image

EA

Emanuel Aguiar04/12/2022 20:31
Compartilhe

Conversão de tipos em Python - Fundamentos

  • #Python

Conversão de tipos - Fundamentos de Python

Ex:

valor = 10.9

print(int(valor))

-> 10

No exemplo acima, o valor 10.9, no tipo float , foi convertido para o tipo inteiro.

Ex:

valor = 10

valor_str = str(valor)

print(type(valor))

print(type(valor_str))

-> <class 'int'>

-> <class 'str'>

"Type" mostra o tipo de dado.

https://github.com/EmanuelAguiar6/exer-python

Compartilhe
Comentários (0)