Simple Python Program For beginners!!

Simple Python Program For beginners!!



- Python is a Multipurpose programming language.

- It has simple easy to use syntax.

Simple Program To Print "Hello World"


Python language is easy to use. simply for print Hello World we have to use Print keyword.

In python there is no need to do semi-colon (;) at the end of code.

Comment : # is used for comment in python.

Program :




 Here is code for print Hello World with out semi-colon and output will,

Output : Hello World 

    or




Here, the code is with semi-colon.

Output : Hello World

So, as we can see there is no difference between output.


How To Get Data From User  OR


Use Of input Statement


If we want to get data from user then we have to use input keyword.

Program :





Here we take data from user then we have to store it into a variable.

So, here we store in name variable which data we take from the user.

After that we print that variable with print keyword and name variable.

Output :

Enter your name : Khush  // khush is data given by user

Khush



Concatenation Of String 


If we want to print above output as Hello Khush then we have to concat (join) the word Hello and name variable.

" + " operator is used for concatenation in python.

Program :





Output :

Enter your name : Khush  // data from user

Hello Khush     // output



  • In next article we discussed about all string operations in python.So,Keep Join With Us.