Repository navigation
Expand file tree
/
Copy path006-Float-Data-Type.py
More file actions
77 lines (64 loc) · 3.28 KB
/
Copy path006-Float-Data-Type.py
File metadata and controls
77 lines (64 loc) · 3.28 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
77
"""
===============================================================================
Float Data Type
===============================================================================
Program Description:
--------------------
This program demonstrates the Float (float) data type in Python.
A float is a numeric data type that represents decimal (floating-point)
numbers. Float values can be positive, negative, or zero with a decimal
point.
Author : Shaik Mahaboob Basha
Repository : 13-Python
File Name : 06-Float-Data-Type.py
===============================================================================
"""
# -----------------------------------------------------------------------------
# Creating a float variable named number1.
# The variable stores a positive decimal value.
# -----------------------------------------------------------------------------
number1 = 10.5
# number1 contains the float value 10.5.
# -----------------------------------------------------------------------------
# Creating a float variable named number2.
# The variable stores a negative decimal value.
# -----------------------------------------------------------------------------
number2 = -25.75
# number2 contains the float value -25.75.
# -----------------------------------------------------------------------------
# Creating a float variable named number3.
# The variable stores the decimal value 0.0.
# -----------------------------------------------------------------------------
number3 = 0.0
# number3 contains the float value 0.0.
# -----------------------------------------------------------------------------
# Displaying the value stored in number1.
# -----------------------------------------------------------------------------
print("Value of number1 :", number1)
# Output: Value of number1 : 10.5
# -----------------------------------------------------------------------------
# Displaying the value stored in number2.
# -----------------------------------------------------------------------------
print("Value of number2 :", number2)
# Output: Value of number2 : -25.75
# -----------------------------------------------------------------------------
# Displaying the value stored in number3.
# -----------------------------------------------------------------------------
print("Value of number3 :", number3)
# Output: Value of number3 : 0.0
# -----------------------------------------------------------------------------
# Displaying the data type of number1.
# type() is a built-in function used to identify the data type of a variable.
# -----------------------------------------------------------------------------
print("Data Type of number1 :", type(number1))
# Output: Data Type of number1 : <class 'float'>
# -----------------------------------------------------------------------------
# Displaying the data type of number2.
# -----------------------------------------------------------------------------
print("Data Type of number2 :", type(number2))
# Output: Data Type of number2 : <class 'float'>
# -----------------------------------------------------------------------------
# Displaying the data type of number3.
# -----------------------------------------------------------------------------
print("Data Type of number3 :", type(number3))
# Output: Data Type of number3 : <class 'float'>