adsense

Monday, 11 July 2016

Python Programming

To all my viewers I'm currently a member of the internship program for a human welfare council and I need your help to assist the people who need us by donating any amount you can. YOUR SMALL GESTURE WILL HELP A FAMILY SMILE. Follow the link and you will get to our campaign page :


Please after funding whatever amount you can share me the screenshot of the receipt to my email - sumanmukherjee2001@gmail.com
So that I can send you a receipt for the contribution you made and tell the happiness you shared. 😊





 C'mon now we need to work hard from here on to get into python. However at the end you'll keep on saying in your mind ,"It was so simple stupid and you thought programming is not for me".

So, we'll start the course with the basic knowledge of variables,strings,integer,float .

                                        Variables :-


Wait you're like , "man I've heard about it. But where the shit I've used them  ?" 
It was your maths teacher who taught you about this in your junior classes . Remember 'linear equations','quadratic equation' where you needed to find the value of  X,Y and so on.
Yeah same with here. 

In python variable stores a data so that you can use it any time in your program later. Think it like a box that can hold values !


Here in the example, 
1. 'adam' is given a value "boy".
2. 'christie' is given a value "girl" .

so whenever in our program we type 'adam' , python will search for the name and then will see what is the value . It will then show or use the value assigned to it. Similarly in case of 'christie' , python will search and use the value that we've given to it.
So, when we type 'adam', python will return as shown in the picture.


'adam' returns "boy" and 'christie' returns "girl".

Q. Why to use variables ?

Ans. Well, when you write a program it happens that you have to type the same data again and again. So, to reduce the efforts ,you can store the data in a variable and call it anytime you want them.

Example :-


Here, I've used it for a simple equation.

                                      Strings :-


In python. text values are called STRINGS .A string in python begins and ends with a quotes.However the quotes are not a part of the value's text. 


Strings can have any keyword in them and can be as long as you want !
 You can also add stings like numbers . Just type a string give a '+' sign between them (without quotes) and then type another string and repeat as much as you want.

Q. Can we store a string in a variable and then add them ?
Ans. Hell yeah dude ! you can just go for it .





                         Integer and Floating point :-



Integers (or ints for short) are whole numbers such as 4, 99, and 0. 



Floating point numbers (or floats for short) are fractions or numbers with decimal points like 3.5, 42.1 and 5.0.

 In Python,

the number 6 is an integer, but 6.0 is a float. These numbers are called values.



You can define a value to be integer or float or a string just by typing   for :-


 Strings -  str("")


Integers - int()


Note that when you declare a variable a integer or float or a string , you may or maynot use quotes. Python will identify it as the instruction passed like - str(), int(), flt()

Float - float()




No comments:

Post a Comment