Followers

Monday, 14 November 2022

Program to Perform basic Arithmetic operations in Python

 In python, we do need to declare the datatype of variable in Python as in C,C++/Java. We can just assign a value to a variable name and perform the respective operation. For  example if we need to add numbers in Python we can just assign as such a=10 and b =10.  The below program describes all the allowed basic arithmetic operators in Python.

  


  1. we do not need to specify a new line character explicitly in print() function, whenever new print() function  is encountered it assumes to print in new line.
  2.  "# '  is comment line to enable the programmer for better understanding of code.

Reference of the code run in JupyterLab 



Print HELLO WORLD by storing into String Variable

 We can also print HELLOWORLD or any other user required message by storing it into another variable

                   

Reference of the code run in JupyterLab

How to print HELLO WORLD in python?

          

 Let us learn how to print "HELLO  WORLD" in python..

In python programming we use print(). The print () function print the python objects  to other standard output device. Here the python object is String which contains message "HELLO WORLD". We can enclose the string in either single quotes(' ')  or  double quotes(" "). both will give you the same output.


       Reference of the code run in JupyterLab