Python :
Python is high level programming language with application in numerous areas including web programming, scripting, scientific computing, and artificial intelligence.
First Program: "Hello World"
So let's take our first foot into the world of Python.Open the console and type : print("Hello World") and press enter.
Hurry!! you have just created your first program. But remember python is
case sensitive here P & p are different for python, so be careful
about this.
Printing Text :
The print statement can also be used to output multiple lines of text. To do so you have to use three quotation marks{"} and put the text between them.
There are some other methods as well for the multiple line text output, like instead of using three quotation marks we can use {\n} to escape a newline in text aka string.
Simple operations in python:
Python has the capability of carrying out
calculations.Enter a calculation directly into the python console, and it will give you the output. Like if you want to perform the addition operation just type the numbers and place the {+} sign between them and then hit the enter.
Subtraction, Multiplication, Division:
Now to perform subtraction use {-} sign in between the numbers, for multiplication use {*} sign and for division use the symbol {/} and {//} for floor division.Exponential :
Quotient and Remainder :
To determine the quotient and remainder of a division, use floor division{//} and modulo{%} operators respectively.Floor division is done using two forward slashes{//}.
The modulo operation is carried out with a percent {%} symbol.
The operators can be used with both floats and integers.
Note :
These are some of the introductory program for the python beginners. It will give them the essence of coding while performing these tasks. So perform these by yourself and keep your learning trajectory upwards.
Comments
Post a Comment