Day 3 of learning python

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aviral Bhardwaj

Aviral Bhardwaj

One of the youngest writer and mentor on AI-ML & Technology.