adsense

Sunday, 7 August 2016

WRITING OUR FIRST PROGRAM


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. 😊



1 -   The first program in any programming language is always the "HELLO WORLD". So lets begin with this simple code :- 

---------------------------------------------------------------------------------
print ("HELLO WORLD")
---------------------------------------------------------------------------------
Thats it!!!

Now the function "print" is new here . Its function is to print something on the console. 

("HELLO WORLD")

As we know HELLO WORLD is a string hence we have to put it inside two quotes " ".

2 - A program that adds two number(according to the user)  :-


--------------------------------------------------------------------------------------------------------------------------

num1 = int(input("ENTER YOUR FIRST NUMBER"))
num2 = int(input("ENTER YOUR SECOND NUMBER"))

print (num1+num2)
--------------------------------------------------------------------------------------------------------------------------

Here a new function has been introduced INPUT. What it does is that it asks the user to enter their number and then it stores that number into the variable name "num1" or "num2". So whenever the variables are called , the input enterd by the user is taken and added.  Hence, we use input whenever we need to take the data enterd by the user.

Next , inside the print function, we just add the two variables by putting  a "+" sign between them.


Keep visiting for more tutorials.

No comments:

Post a Comment