Day 3 of learning python
mastering python fundamentals in 10 days
Hey guys I welcome you to the third day of your python course
topics we will be covering
- variable
- comments
- escape characters
- input function
- typecasting
Variable
the variable is created as soon as we assign a value to it variables make our code look shorter and neat
for eg we are assigning a value to x,y,z let’s say we are assigning it 10,20,30
so when we call x,y,z in the future it will return the value which we have assigned it to you
Comments
comments is basically a code of line that will not run and it helps as we describe the code
there are 2 types of comments
single-line comment — a single line comment is created by an #
multi-line comment — whereas a multiline comment can be created by “‘ ’”
Escape characters
to insert some characters we use escape characters An escape character is a backslash \
code and examples
\n Inserts a new line in the text at the point
\” Inserts a double quote character in the text at that point
\\ Inserts a backslash character in the text at the point
\’ Inserts a single quote character in the text at that point
\t Inserts a tab in the text at that point
\f Inserts a form feed ln the text at that point
\r Inserts a carriage return in the text at that point
\b Inserts a backspace in the text at that point
Input function
an input function takes an input from the user and can use later for other purposes
Type casting
the process of converting the value of one datatype into another datatype is known as typecasting
in this example we are taking a as a string and b as a integer and then we are changing the type of a from string to integer and then we can add
conclusion
I hope you all had a good understanding of today’s topics. On day 4, we will cover the list, dictionary, tuples, sets, and operations on them.