Tips:
I strongly believe that if you continue with the course for a month and complete the tasks given to you daily then no one can stop you from learning python it will hardy take 2 hrs a day and you will see good results in near future . Don't study from middle instead of it start from the basics and then go for advance. Following are some tips for how you should go with the course.
- Read the Blog carefully.
- Even though if you know program in blog you should execute all of them in you editor.
- Solve practice question and Quiz from our google class room link will sent on WhatsApp.
- Neve mug up , Always try to understand the concept and while studying ask the question to yourself as much as you can and doubts as asked by the Ashoka in the blog.
- We are using a virtual character Ashoka to frequently asked doubts but even after that you have any doubt you can ask it in comments or if you area a registered student then you can also ask on WhatsApp.
- You can also you various online python compliers in case you can't access your pc.
What is python?
Python is an object-oriented, high-level programming language with integrated dynamic semantics primarily for web and app development. It is extremely attractive in the field of Rapid Application Development because it offers dynamic typing and dynamic binding options.Why you should learn python among all other languages in 2020 and what is the scopes in python?
Because python is No. 1 trending language in the world right now as it is road map toData Science, Artificial Intelligence, Web Development , Scripting and Automation and much more.
following are some important features of python language:
- Easy to Learn
- Cross-Platform and Open Source,
- Versatile Language and Platform
- Flexibility
How to install python?
Step 1) Go to official python website to download the python depending on your operating system.
link to download latest python version.
Step 2)Open file

step3)Select the add python in path as shown in the image.
Step4)Click on install to install python.
How to install Python editor?
The basic way to create and run a Python program is to create an file with pgmName.py extension and then run it using command line. However, if you want to be productive you should use python editor.
use any python editor of your choice in because it provides smart code completion, code inspections, on-the-fly error highlighting and quick-fixes, along with automated code refactoring's and rich navigation capabilities.
recommended editors:
use any python editor of your choice in because it provides smart code completion, code inspections, on-the-fly error highlighting and quick-fixes, along with automated code refactoring's and rich navigation capabilities.
recommended editors:
1)pycharm: community edition
download link: https://www.jetbrains.com/pycharm/download/
2)Atom :
2)Atom :
download link:https://atom.io/
we are using pycharm during this course.
we are using pycharm during this course.
How to write and run your first python program in pycharm?
If you don't know how to how to install and setup pycharm please refer the following video.
So. first thing you can do while start learning any programming language is by printing something using that language code and you are lucky because printing something in python is very simple you can print anything by using
print()
you don't have to remember it as we use print() itself to print something😊.
to print string you have to use " " or ' ' inside the print function.
print("hello") or print('hello')
print(123)
to print integer we don't have to use anything we can simply write integer inside print() to print any integer as shown in the above examples.
Now let's see some more example to understand how it works:
Python Code: Output:
print("Python") Pythonprint(' Sunny day') Sunny dayprint('123') 123print('5+4') 5+4print(5+4) 9print(5*4) 20
As you see print('5+4') ==> 5+4 because anything inside " " will be count as an string so , it will print exact same string as an output but if we print(5+4) then it will print 9 because in this case 5 and 4 are integers so python will add them .
Ashoka: what is print()?
print() is a python built-in function created to print something using python.
Ashoka: what is built-in function?
built-in function are the functions created by the python creators you so you can simply call it then it will do it's work that is defined by its creator. E.g. we can call Print() function to print something.
Ashoka: Can I create my own function?
Yes, you can create your own function . Here is a small example for you to understand how you can create your own function.
def sum(a,b): --1return a+b --2print(sum(7,7)) --3
Now we have created a function (in line 1&2) called sum() and as you can see we have defined its work to add number inside it. So if you write any two number inside it will add it automatically. E.g we call Sum() in third line to add two integers. That's all for now we will see in detail about this topic in coming lectures.
Ashoka: How I print multiple line string because I got error by using above Method ?
Well For that you print multiline string such as the following
How I wonder what you are
Up above the world so high
Like a diamond in the sky
by using """ """ or ''' ''' inside the print function as follows:
print("""Twinkle ,twinkle, little starhow I wonder what you areup above the world so highlike a diamond in the sky""")
Ashoka: yes that's work for me.
Now I think you know how to print something in python. So now let's move on the next topic called variable.
Variables:
Variables are containers for storing data values. In simple words its just a naming of some kind of data.
Ashoka :Why we need variables? can write program without variables?
Yes, Ashoka you can Without variables programs but, we can only write programs thatdo exactly the same thing each time, for example in toy programs.
For example, assume that we want to write a program that calculates the area of a circle given its radius. then without variable we need to edit the program again and again to change the constant value of the program .
Ashoka: How to Declare and use a Variable?
a=100
print (a)
Rules to assign a variable name
Variable NamesA variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). - A variable name must start with a letter or the underscore character
- A variable name cannot start with a number
- A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
- Variable names are case-sensitive (age, Age and AGE are three different variables)
Types of variables
Local Variables
A variable declared inside the function's body or in the local scope is known as a local variable.example:
How Create a Local Variable:
def foo():
y = "local"
print(y)
foo()What if we try to Accessing local variable outside the scope.def foo():
y = "local"
foo()
print(y)Output:
NameError: name 'y' is not defined
Global Variables
In Python, a variable declared outside of the function or in global scope is known as a global variable. This means that a global variable can be accessed inside or outside of the function.
Example:
x = "global"
def foo():
print("x inside:", x)
foo()
print("x outside:", x)Output:
x inside: globalx outside: global
Nonlocal Variables
Nonlocal variables are used in nested functions whose local scope is not defined. This means that the variable can be neither in the local nor the global scope.
Example:
def outer():a = "local"def inner():nonlocal aa = "nonlocal"print("inner:", a)inner()print("outer:", a)outer()
How to re-declare a Variable?
You can re-declare the variable even after you have declared it once.
x= 0print( x)# re-declaring the variable worksx= 'Jack'print (x)
output:
0Jack
How to Concatenate different data types with Variables?
For example, we will concatenate "Jack" with his age "24".Name ="Jack"Age= 24print(Name+Age)
Output :
TypeError: can only concatenate str (not "int") to strAs you seen you will get the above error because you can only concatenate strings together not integers with strings.
Ashoka :What should I do if I required to Concatenate string with integer?
In that case you should first convert the integer into string and then perform concatenation as follows:
(1)print(Name+str(Age) or (2)print(Name+" "+str(Age)) or (3) print(Name+", "str(Age))
Output :
(1)Jack24(2) Jack 24(3) Jack, 24
Now you got the correct answer because you converted the integer into string and that why now we have two string so we can concatenate. Check the difference in the code and then its output for 1,2,3 .
How to delete a variable?
You can also delete variable using the command del "variable name" as follows:x = 11;print(x)del( x)print(x)
Output:
NameError: name 'x' is not defined11
Data Types:
Data types are the classification or categorization of data items. Data types represent a kind of value which determines what operations can be performed on that data.Numeric:
A numeric value is any representation of data which has a numeric value.Integer:
Positive or negative whole numbers (without a fractional part)
5
Float:
Any real number with a floating point representation in which a fractional component is denoted by a decimal symbol or scientific notation.
5.5
Complex number:
String:
A string value is a collection of one or more characters put in single, double or triple quotes.
For example:
name:"python hub"
Complex number:
A number with a real and imaginary component represented as x+yj. x and y are floats and j is -1(square root of -1 called an imaginary number)
Boolean:
Data with one of two built-in values True or False. Notice that 'T' and 'F' are capital. true and false are not valid Booleans and Python will throw an error for them.Sequence Type:
A sequence is an ordered collection of similar or different data types. Python has the following built-in sequence data types:
String:
A string value is a collection of one or more characters put in single, double or triple quotes.
For example:
name:"python hub"
List :
A list object is an ordered collection of one or more data items, not necessarily of the same type, put in square brackets.
For example:
languages=[('English','Albanian'),'Gujarati','Hindi','Romanian','Spanish']Tuple:
A Tuple object is an ordered collection of one or more data items, not necessarily of the same type, put in parentheses.
For example:
(Apple, Grapes, Orange)
Dictionary:
A dictionary object is an unordered collection of data in a key:value pair form. A collection of such pairs is enclosed in curly brackets.
For example:
{1:"Jack", 2:"Carry", 3:"Nancy", 4: "Ashoka"}
Set:
Python Set is the unordered collection of the data type.
For example:
{'A', 'V', 'A', 'J', 'P', 'T', 'O', 'I'}Note :
type() function
type() is an python in-built function it is used to ascertain the data type of a certain value. In simple words it is used to check the type of data.For example:
print(type(123))
output:
<class 'int'>
..................
which means 1234 is an integer value.
enter type(1234) in Python shell and it will return <class 'int'>, which means 1234 is an integer value. Try and verify the data type of different values.
Number values, strings, and tuple are immutable, which means their contents can't be altered after creation.
Mutable and Immutable Objects:
Data objects of the above types are stored in a computer's memory for processing. Some of these values can be modified during processing, but contents of others can't be altered once they are created in the memory.Number values, strings, and tuple are immutable, which means their contents can't be altered after creation.
On the other hand, collection of items in a List or Dictionary object can be modified. It is possible to add, delete, insert, and rearrange items in a list or dictionary. Hence, they are mutable objects.

The google classroom id will be sent to all students for practicing todays topic questions.
Thanks guys that's all for today don't forget to practice .practice question , assignment ,Quiz link will be sent to registered students .

13 Comments
In definition of local variable :
ReplyDeleteA variable declared inside the function's body or in the local scope is known as a local variable.
example:
def foo():
y = "local"
foo()
print(y)
Output:
local
print(y) is outside is function so shouldn't it throw an error ?
Yes your right it's a typing mistake we updated few things please check out now thanks for your contribution.
DeleteSir, in re-declare a variable
ReplyDeleteYou did
x=0
print(f)
But, in print function isn't there should be x in the print function to print the output?
That's a typing mistake thanks for your contribution we update few things in the blog please check it out now.
Deleteinteger type and string type cannot be concatenate
ReplyDeleteThanks for your contribution we update few things in the blog please check it out now.
Deletei have been registered in this python course but i didn't get link of questions and quiz. This may be because i am not using whatsapp right now because of my personal reasons. So, could you please send me the link to my mail id? That would be great, Thank You.
ReplyDeleteemail:nirajjayswal01@gmail.com
We sent link on your mail.
DeleteWe have to do all this things in pycharm or python
ReplyDeletePycharm is just an python editor which is more user friendly fir running and writing python codes instead of cmd. So you use of pycharm will require to install python in your computer.
Deletehello, is day 2 is released in these blog?
ReplyDeletewhen day 2 is coming?
ReplyDeleteThank you for sharing wonderful information
ReplyDeleteBest Python Online Course Hyderabad
Best Python Training Online