Repository navigation
Expand file tree
/
Copy path005-Integer-Data-Type.py
More file actions
76 lines (63 loc) · 3.22 KB
/
Copy path005-Integer-Data-Type.py
File metadata and controls
76 lines (63 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
===============================================================================
Integer Data Type
===============================================================================
Program Description:
--------------------
This program demonstrates the Integer (int) data type in Python.
An integer is a whole number without any decimal point.
Integers can be positive, negative, or zero.
Author : Shaik Mahaboob Basha
Repository : 13-Python
File Name : 05-Integer-Data-Type.py
===============================================================================
"""
# -----------------------------------------------------------------------------
# Creating an integer variable named number1.
# The variable stores a positive integer value.
# -----------------------------------------------------------------------------
number1 = 100
# number1 contains the integer value 100.
# -----------------------------------------------------------------------------
# Creating an integer variable named number2.
# The variable stores a negative integer value.
# -----------------------------------------------------------------------------
number2 = -50
# number2 contains the integer value -50.
# -----------------------------------------------------------------------------
# Creating an integer variable named number3.
# The variable stores the value zero.
# -----------------------------------------------------------------------------
number3 = 0
# number3 contains the integer value 0.
# -----------------------------------------------------------------------------
# Displaying the value stored in number1.
# -----------------------------------------------------------------------------
print("Value of number1 :", number1)
# Output: Value of number1 : 100
# -----------------------------------------------------------------------------
# Displaying the value stored in number2.
# -----------------------------------------------------------------------------
print("Value of number2 :", number2)
# Output: Value of number2 : -50
# -----------------------------------------------------------------------------
# Displaying the value stored in number3.
# -----------------------------------------------------------------------------
print("Value of number3 :", number3)
# Output: Value of number3 : 0
# -----------------------------------------------------------------------------
# Displaying the data type of number1.
# type() is a built-in function that returns the data type of a variable.
# -----------------------------------------------------------------------------
print("Data Type of number1 :", type(number1))
# Output: Data Type of number1 : <class 'int'>
# -----------------------------------------------------------------------------
# Displaying the data type of number2.
# -----------------------------------------------------------------------------
print("Data Type of number2 :", type(number2))
# Output: Data Type of number2 : <class 'int'>
# -----------------------------------------------------------------------------
# Displaying the data type of number3.
# -----------------------------------------------------------------------------
print("Data Type of number3 :", type(number3))
# Output: Data Type of number3 : <class 'int'>