Coerção de tipos (converter um tipo em outro)
This commit is contained in:
9
aula6.py
Normal file
9
aula6.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# conversão de tipos, coerção
|
||||
# type convertion, typecasting, coercion
|
||||
# é o ato de converter um tipo em outro
|
||||
# tipos imutáveis e primitivos:
|
||||
# str, int, float, bool
|
||||
print(int('1'), type(int('1')))
|
||||
print(type(float('1') + 1))
|
||||
print(bool(' '))
|
||||
print(str(11) + 'b')
|
||||
Reference in New Issue
Block a user