How to Define a Type
We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5
might be? It's easy to calculate that it equals 4
, but what type does 4
belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type()
function.
123variable = 6/1.5 print(variable) print(type(variable))
Swipe to start coding
An accountant received two reports: one contains the total revenue for the month, and the other records the number of successful transactions. Before calculating the average revenue per transaction, it's important to check if the data types are correct.
- Check the type of the
number1
variable, which stores the total revenue. - Check the type of the
number2
variable, which stores the number of transactions.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 3.03Awesome!
Completion rate improved to 3.03
How to Define a Type
We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5
might be? It's easy to calculate that it equals 4
, but what type does 4
belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type()
function.
123variable = 6/1.5 print(variable) print(type(variable))
Swipe to start coding
An accountant received two reports: one contains the total revenue for the month, and the other records the number of successful transactions. Before calculating the average revenue per transaction, it's important to check if the data types are correct.
- Check the type of the
number1
variable, which stores the total revenue. - Check the type of the
number2
variable, which stores the number of transactions.
Solução
Obrigado pelo seu feedback!
single
Awesome!
Completion rate improved to 3.03
How to Define a Type
Deslize para mostrar o menu
We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5
might be? It's easy to calculate that it equals 4
, but what type does 4
belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type()
function.
123variable = 6/1.5 print(variable) print(type(variable))
Swipe to start coding
An accountant received two reports: one contains the total revenue for the month, and the other records the number of successful transactions. Before calculating the average revenue per transaction, it's important to check if the data types are correct.
- Check the type of the
number1
variable, which stores the total revenue. - Check the type of the
number2
variable, which stores the number of transactions.
Solução
Obrigado pelo seu feedback!