0% found this document useful (0 votes)
9 views3 pages

Python Notes

Python is a widely-used programming language created by Guido van Rossum in 1991, suitable for web development, software development, mathematics, and system scripting. It utilizes statements for instructions, supports variables for data storage, and has built-in data types such as strings, integers, and floats. Comments in Python begin with a #, and operators are used to perform operations on variables and values.

Uploaded by

devnaiscool
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Python Notes

Python is a widely-used programming language created by Guido van Rossum in 1991, suitable for web development, software development, mathematics, and system scripting. It utilizes statements for instructions, supports variables for data storage, and has built-in data types such as strings, integers, and floats. Comments in Python begin with a #, and operators are used to perform operations on variables and values.

Uploaded by

devnaiscool
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON

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.

A computer program is a list of "instructions" to be "executed" by a computer.

In a programming language, these programming instructions are


called statements.

The following statement prints the text "Python is fun!" to the screen:

print("Python is fun!")

Text in Python must be inside quotes. You can use either " double quotes
or ' single quotes:

print("This will work!")


print('This will also work!')

However, unlike text, we don't put numbers inside double quotes:

print(358)
print(50000)

You can combine text and numbers in one output by separating them with a
comma

print("I am", 13, "years old.")


Python Comments

Comments start with a #, and Python will ignore them:

#This is a comment
print("Hello, World!")

Python Variables

Variables are containers for storing data values. A variable is created the moment
you first assign a value to it.

Example

x=5 # x is of type int


y = "John" # y is of type str
print(x)
print(y)

Rules for Python variables:

• A variable name must start with a letter or the underscore character

• A variable name cannot start with a number

• A variable name can only contain alpha-numeric characters and underscores


(A-z, 0-9, and _ )

• Variable names are case-sensitive (age, Age and AGE are three different
variables)

• A variable name cannot be any of the Python keywords.

DATATYPES

Variables can store data of different types, and different types can do different
things.
Python has the following data types built-in by default

x = str("Hello World") str

x = int(20) int

x = float(20.5) float

Python Operators

Operators are used to perform operations on variables and values.

You might also like