+ 1
Can u perform type conversion integer to float?
This is an example of above problem a=4 c=float(a) print(c)
13 Answers
+ 3
In both case int to float or vice versa we can perform no matter size of data type in python
+ 3
No, we can not declare 6.23 as integer but we can change in integer like
a=6.23
b=int(a)
print(a)
+ 3
I assume you are talking about Python.
Yes, you can always convert floats to integers and integers to floats.
+ 3
All can see executable code of this problem after the open my profile and open code
+ 3
yes anikesh kumar you are right
it has converted float data type to integer
đđ»đđ»
+ 2
we can use integers in float it is accepted as obviously 6 is 6.00 and is acceptable float with no numbers after decimal point however vice versa cannot be done i.e we cannot write say 6.23 as an integer
+ 2
Yes we can it reduce the 6.23 into 6.
You can write code and check it
+ 1
yes that is right
float stores 4 bytes
whereas int can 2 bytes (in general say c++)
+ 1
Yes u all are right thanks
+ 1
no anikesh kumar you cannot declare 6.23 as an integer
obviously if u round it to 6 then yes 6 can be declared as integer
0
Yes, you can.
0
How?
0
Like in the code above.