Type casting in Python is easy 💱
Vložit
- čas přidán 3. 08. 2024
- type casting = The process of converting a value of one data type to another
(string, integer, float, boolean)
Explicit vs Implicit
name = "Bro"
age = 21
gpa = 1.9
student = True
print(type(name))
print(type(age))
print(type(gpa))
print(type(student))
age = float(age)
print(age)
gpa = int(gpa)
print(gpa)
student = str(student)
print(student)
name = bool(name)
print(name)
00:00:00 what is type casting?
00:01:24 type function
00:02:23 explicit cast
00:06:17 implicit cast
#type #cast #casting
# type casting = The process of converting a value of one data type to another
# (string, integer, float, boolean)
# Explicit vs Implicit
name = "Bro"
age = 21
gpa = 1.9
student = True
# print(type(name))
# print(type(age))
# print(type(gpa))
# print(type(student))
age = float(age)
print(age)
gpa = int(gpa)
print(gpa)
student = str(student)
print(student)
name = bool(name)
print(name)
Hi brocode I love your videos you helped me so much starting with java and we can watch that all for free THX 😊
bro what is name of tool you are using it's vscode or what
@@Cp_elishapycharm
And he downloaded python online
Watch the first video of the series
I love how bro almost put his GPA as 4.0 and then backspaced 😂
Thank you for breaking everything down into such an easily understandable explanation!
Outstanding Explanation I have ever watched!
imp Only strings can concatenate.
student = True
print(student)
print(type(student))
student = str(student)
print(student)
print(type(student))
print("Hello" + student)
True
True
HelloTrue
Just found this amazing Python playlist, thanks for your help
I can't believe that I found an easy way to learn python! I'm so grateful thankss a lott!!
NICELY DONE...❤
bro it's awsome
i admit here new
INSAALLAH soon i will finised the playlist💖
I appreciate your training approach; it's clear, enjoyable, and straightforward. Thank you for keeping it simple and to the point.
NICELY DONE BRO...❤
Thank you for this wonderful video.
very logical and useful, making the complex theory understandable!!
I glad to see your channel grow and learning program from your channel, being game programmer is always my dream.
Mine too!
Perfect. absolutely perfect🤯🤩🤩
Have watched u since first long collection of videos
Nice to see that u still help to other people
Btw wanna see more guides by you
thanks
3rd hello!!, all ur vids are good that's i got a improve in programming.
I have always believed that education is the ultimate code to crack. Thanks to Bro Code, I have been able to unlock some of the most complex programming languages and computer science concepts with ease. Your videos have been instrumental in helping me level up my skills. So, from the bottom of my heart (and stack), thank you for being the best educational channel out there. Keep up the good work, Bro Code! Your dedication to educating the masses about programming languages and computer science has been truly inspiring. I would love to connect with you and learn more about your journey and how you became one of the best educational channels out there. again, thank you for being a constant source of knowledge and inspiration for us all. You're the real MVP, Most Valuable Programmer
Wow, i'm the first one here. Hello and thank you for the video!
Wait how?
Great explanation
Great explanation. Thanks Bro!
thank you for your time and efforts and teaching me this.
This was usefull, thank you
Your crazy man, so easy to understand, even tough I am from arts background.
Recently I seen ur channel bro
I like the way ur teaching bro
Tq bro keep doing like this for us bro💕
Basically bool is to check whether that INPUT IS GIVEN OR NOT.
userinput = input("Your name: ")
userinput = bool(userinput)
print(userinput)
if user give any input then True if user does not give any input then False.
#code1
name = "Bro"
name = bool(name)
print(name)
True
#code2
name = "" #empty string. As there is nothing that's why it will be false.
name = bool(name)
print(name)
False
you are the best.
Watched it. Liked it.
this chanel is very helpful for me! thanks bro code
Finally thank you very much
good job , thanks
helpfull and thankyou
very helpful bro!
Very helpful I appreciate the teaching 🫵🏾💯
i love this channel
Me too!
Yes
Bro code : Uploaded a video
his fans be like : Finally we can find inner peace
Probably important to note that in other programming languages such as Java, you can't just change the data type of a variable.
int num = 3;
num = (float) num;
This would throw an exception because you can't assign a float to an integer variable.
that's a good point
@haltsmaul I come from Java as well, there is a way to do that in python?
Grateful
thx 4 vid bro !
Appreciate you "Bro"
appreciate your bro
in my pycharm version when i convert a float to string it just round offs the number like 4.9 becomes 5 and while converting boolean to an integer true becomes 1 and false becomes 0
I am watching your videos during the lectures because the professor is boring. The efforts you put into each video is incredible.
Can you also make tutorials about MIPS assembly language?
I'll take a look at MIPS but I do have a lot of other work to do too :(
@@BroCodez just a question, do you work as a programmer? if yes, how much do you make? i am thinking in become a senior programmer but im unsure
Thank you
thanks bro
thank you bro
random comment because this tutorial is great
thank you Bro
Nice😂😂
thanks Bro
Please see my comment and hope you liked it because TBH I am your big fan and you reached programming to me and am still watching your playlist of python cuz I wanna learn it!
usefull
Thanks
thx bro :D
wow
i love you bro ur the god
Interesting. I need to know how to do this in Java.
thanks
❤
thank
yeyeyey
thank you bro code
What program do you use to code? (Btw, I'm beginner :))
I know I am late but in this video he is teaching python
how does every one else do a course like this. do you use the same file for every single episode or do you save a separate one for each or do something else?
You must be far in there now, I hope you used seperate files or you may of been confused lol, I'm learning also and love it
Done
Random Comment
already subscribed so i am an Authentic Fellow Bro
OK??
yes more python
When typecasting an integer to bool, it is always True for any positive or negative number except for.
For zero, it is false.
#code
age = 19
age = bool(age)
print(age)
True
#code
age = 0
age = bool(age)
print(age)
False
gpa = 1.9
gpa1 = int(gpa)
gpa2 = (gpa%1)
gpa3 = gpa1 + gpa2
print(gpa3)
1.9
Any git and Linux tutorial?
can you do one more Winform course I'm having a problem with it, Bro Code please help me :((
I love you
So is type casting in Py the same as type conversion in JS?
I’m on the train of bros
this dude sounds like chris McLean
can i use vs code instead
Hey Girl... I don't care if you are not my type. We can always typecast
my gpa would be a solid ahh 4.0 no no no 1.9
name = “Bro Code”
age = 22
rating = 100.0
useful = True
Oh
Free algorithm
do you have c or c++ course
3/106
can i please know which country ur from ??
Isn’t it obvious he’s an American?
student = True
print(student)
print(type(student))
student = str(student)
print(student)
print(type(student))
True
True
What is GPA full form?
grade point average.”
a random comment
"Type casting is easy"
Also me: why code no work I spend 5 hours trying to solve and I saw this vid and I was at the problem💀
random comment :)
Random comment
A Random Comment
random comment
RANDOM COMMENT( ̄▽ ̄)
random
You now how numpy casting works in your C source code?
I love you
Random comment
random comment