Numbers
In the previous chapters, you operated with numbers. There are many variants of number classifications in math (negative/positive, rational/irrational, etc.). How does Python distinguish between numbers? There are three numerical types in Python:
float
- represents a floating-point numberint
- represents an integer/whole numbercomplex
- represents a complex number
We won’t focus too much on complex numbers, since this is a branch of Further Mathematics. To get the type of a certain value/variable, use the type()
function. For example, let's output the types of the numbers 5
and 10.5
.
123456# Creating the variables number1 = 5 number2 = 10.5 # Output the types of numbers print(type(number1)) print(type(number2))
Bedankt voor je feedback!
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 4
Numbers
Veeg om het menu te tonen
In the previous chapters, you operated with numbers. There are many variants of number classifications in math (negative/positive, rational/irrational, etc.). How does Python distinguish between numbers? There are three numerical types in Python:
float
- represents a floating-point numberint
- represents an integer/whole numbercomplex
- represents a complex number
We won’t focus too much on complex numbers, since this is a branch of Further Mathematics. To get the type of a certain value/variable, use the type()
function. For example, let's output the types of the numbers 5
and 10.5
.
123456# Creating the variables number1 = 5 number2 = 10.5 # Output the types of numbers print(type(number1)) print(type(number2))
Bedankt voor je feedback!