Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Integers | Numeric Types
Python Data Types

bookIntegers

So, integers are numbers that do not contain a fractional part. These numbers can be both positive and negative (for example 10, -7 both of these numbers are integers). Let's take a look at the example below.

Input:
# Creating integers
x = 7
y = -10
print(f'It's a positive integer: {x}')
print(f'It's a negative integer: {y}')

Output:
It's a positive integer: 7
It's a negative integer: -10

Sometimes you have to check the type of some variables. In python, for it there is an useful function called type(). Let's look at an example of how this function works.

Input:
# Creating integers
x = 7
y = -10
print(f'The type of x is {type(x)}')
print(f'The type of y is {type(y)}')

Output:
The type of x is <class 'int'>
The type of y is <class 'int'>

It's time to practice!

Завдання

Swipe to start coding

Create three variables: a, b, c with the following values: 100, -5, -12350 and check the types of them.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 2
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

Awesome!

Completion rate improved to 3.85

bookIntegers

Свайпніть щоб показати меню

So, integers are numbers that do not contain a fractional part. These numbers can be both positive and negative (for example 10, -7 both of these numbers are integers). Let's take a look at the example below.

Input:
# Creating integers
x = 7
y = -10
print(f'It's a positive integer: {x}')
print(f'It's a negative integer: {y}')

Output:
It's a positive integer: 7
It's a negative integer: -10

Sometimes you have to check the type of some variables. In python, for it there is an useful function called type(). Let's look at an example of how this function works.

Input:
# Creating integers
x = 7
y = -10
print(f'The type of x is {type(x)}')
print(f'The type of y is {type(y)}')

Output:
The type of x is <class 'int'>
The type of y is <class 'int'>

It's time to practice!

Завдання

Swipe to start coding

Create three variables: a, b, c with the following values: 100, -5, -12350 and check the types of them.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

close

Awesome!

Completion rate improved to 3.85
Секція 1. Розділ 2
single

single

some-alt