Friday, December 27, 2024

Python-1

What is Python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

It is used for:

Web Development (server-side),

Software development,

Mathematics,

System scripting.


What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written


Software Installation

First Method Install Visual Studio  



Then Go to the Extensions., and Then Type Python

























Next Install Jupyter NoteBook Extension













Second Method: Go to the URL 









Note:

Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.

Basic Example of Python

Go to Visual Studio Code

File--> New File-







Let us print some sample text 












Python Version

To check the Python version of the editor, you can find it by importing the sys module:






Intro to Python - Syntax

IndentationIndentation refers to the spaces at the beginning of a code line.

We should be using either space or tab while using functions, loops and conditional statements.

In other programming languages we use the Curley braces, which indicates that is a block of code. Where as in the Python we use space or tab








If the indentation is skip, we will get Error














Variables:

Python variables doesn’t need to be embedded with datatype at beginning as python has that capacity to capture the datatype based on the value assigned.

Example: a=10

In above example a is variable, python will assign this variable as int datatype. A is the variable.

Assigning multiple values at the same time.

x,y,z=1,2,3 #This assigns x=1, y=2 and z=3













Variables do not need to be declared with any particular type, and can even change type after they have been set.




No comments:

Post a Comment

Thank you for visiting my blog

Python -3

  Lists It is used to store Collection of data. Lists are created using square brackets: List Items Order cannot be changed. It can have dup...