-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07day.py
46 lines (27 loc) · 910 Bytes
/
07day.py
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
# The conversion of one data type into the other data type is known as type casting in python
# There can be two types of Type Casting in Python –
# Implicit Type Casting : Python converts data type into another data type automatically.
# Explicit Type Casting : Python need user involvement to convert the variable data type into certain data type in order to the operation required.
a = 7
print(type(a))
# Python automatically converts
# b to float
b = 3.0
print(type(b))
# Python automatically converts
# c to float as it is a float addition
c = a + b
print(c)
print(type(c))
# Python automatically converts
# d to float as it is a float multiplication
d = a * b
print(d)
print(type(d))
#################################*******#############################
# int variable
g = 5
# typecast to float
n = float(g)
print(n)
print(type(n))