CASTING IN PYTHON
ALL ABOUT CASTING IN PYTHON
THIS IS CODE OF CASTING IN PYTHON YOU CAN COPY PASTE THIS CODE AND RUN
THIS CODE AND SEE THE OUTPUT IN THIS CODE I HAVE COVER ALMOST WORK RELATED
TO CASTING
| ||
y = int(2.8) # y will be 2 | ||
print(type(y)) | ||
z = int("3") # z will be 3 | ||
print(type(z)) | ||
a = float(1) # x will be 1.0 | ||
print(type(a)) | ||
b = float(2.8) # y will be 2.8 | ||
print(type(b)) | ||
c = float("3") # z will be 3.0 | ||
print(type(c)) | ||
d= float("4.2") # w will be 4.2 | ||
print(type(d)) | ||
e = str("s1") # x will be 's1' | ||
print(type(e)) | ||
f = str(2) # y will be '2' | ||
print(type(f)) | ||
g = str(3.0) # z will be '3.0' | ||
print(type(g)) |
VIDEO RELATED TO CASTING
For notes you can check my website
I hope that it will be very helpful for
I hope that it will be very helpful for
You. For more about python and these type of cheatsheet.
join me🤗🙂🙂
Comment me. what you have like or dislike in this post.
Comments
Post a Comment