Data Types in Python

Veröffentlicht am: 24 August 2021
auf dem Kanal: Free Education For Everyone
6
0

Float's that store positive or negative decimal numbers and complex numbers that store the values of
a plus B.J..
So here A is the real part of A no, and B is the imaginary part, let's say.
So complex numbers are not used that much in Python programming, so that's probably to your benefit.
I know it is designed some days, so let's let's see some of these examples.
So let's create a variable named AI and let's make it 10 and we'll check the data type of this variable.
And as you can see, the data type, the variable AI is integer.
Now, create another variable name be and let it be ninety nine point nine and what you see is the data
type of the variable be is loped.
Now, let's create another variable named See and let it be 45 Jay or 45 point Jay, and as you can
see, the data type of variable C is complex.
All right, so now let's talk about the strength concept, so what is this string?
What is a string?
Has it got anything to do with string theory?
And we'll cover that in a different course.
What do you do have to know here is in Python, as string is traditionally a sequence of characters,
all right, either as a literal constant or as some kind of variable.
So they're the same text it will use in real life.
Strings are among the most popular types in Python.
so how do we define a string in Python?
Well, it just so happens that strings is as simple as assigning a value to a variable.
strewing literals in Python are surrounded by either single quotation marks or double quotation marks
with a single quotation mark, it's like and with a double quotation mark looks like this.
Now, the point to note here is if we start to create the strings with double quotation marks, we have
Finish with double quotation marks.
So we start with a double quotation mark and finish with a single quotation mark.
We'll get an error like this.
So at this point, I really need to mention to you about the print and input functions in Python.
o print and input functions are built in functions, and Python built in functions mean it's just a
function that's defined by Python and we can use it when we call.
We're going to examine it in the functions lesson a little bit later on.
But for now, the print function displays its argument as a line of text.
So let's see it print.
Welcome to Python.
So in this case, the argument welcome to Python is a string, which is a sequence of characters enclosed
in double quotes.
The input function is also a built in function, so it request and then obtain some user input.
So let's have a look.
so we define a variable name named name.
Name equals input.
What's your name?
So here first input will display its string argument to tell the user what to type and then wait for
the user to respond.
So we typed John and Press enter.
So the function input then returns those characters as a string that the program can use.
Now, here we assign that string to the variable name.
One more thing then, and then our lesson will conclude the data type conversion.
Yes, we got to know about what is data type conversion.
Now, as you may know, in most programming languages, the conversion of data types to each other is,
well, it's very important.
Sometimes we may need to perform some conversions between the built in times, so to convert between
types.
snd it's very simple.
We just use the type name as a function.
Now, there are several built in functions to perform conversion from one data type to another, and
these functions return a new object representing the converted value.
Float, integer string, they're all convertors, why don't we give it a shot?
Create a variable named variable, underscore one, and let's let it be 100.
And check the day to type.
It's integer.
Now, if we type like this float variable, underscore one.
And check, it's day to time again.
And what's the result, as you can see here, are variables, data type turns integer to float.
Also, we can change it to string with Star.
SDR variable one.
And the result is, as you see.
It's our variables data type has become.
A string.
And that's it.
So in this lesson, we learned variables as a concept in Python and how to define variables.
Also, we learned what data types are and how to learn the variables type.
We also talked about numbers and strings as data types.
We even learned how to change variables, data type.
So the next lesson we're going to learn the concept of the operator in Python.
See, in the next lesson until then, have a nice day.


Auf dieser Seite können Sie das Online-Video Data Types in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Free Education For Everyone 24 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 6 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!