Getting Started With Python

  • Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.
  • It was created by Guido van Rossum during 1985- 1990

How Python different from other language?

  • Python programs are generally expected to run slower than Java programs and C++, but they also take much less time to develop.
  • Python programs are typically 3-5 times shorter than equivalent Java programs and C++

Basic Things to Remember

  • No Need to declare data type for the variable
  • Python provides no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation.
  • Statements in Python typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote that the line 
  • Statements contained within the [], {}, or () brackets do not need to use the line continuation character.
  • Python accepts single (‘), double (“) and triple (”’ or “””) quotes to denote string literals, as long as the same type of quote starts and ends the string.
  • To Comment in Python “#” is used.
  • For Muti Line comments use triple quotes-’’’ Statments ‘’’

Python Indentation

Python uses indentation to indicate a block of code.

X=10

if x <2:
  print("Five is greater than two!")

print(x)

Python will give you an error if you skip the indentation:

IndentationError: expected an indented block

Taking Input to the User

Python provides the input()function which is used to take input from the user. 

x = input("Enter a name of student:")  

print("The student name is: ", name)  

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *