Py3 SI Intro
Py3 SI Intro
com
Introduction
Ref: Web
Introduction
The official introduction to Python is:
Python is an easy to learn, powerful programming language.
It has efficient high-level data structures and a simple but
effective approach to object-oriented programming.
Python’s elegant syntax and dynamic typing, together with
its interpreted nature, make it an ideal language for scripting
and rapid application development in many areas on most
platforms.
Numbers
Python supports two types of numbers - integers and floating point numbers. (It also
supports complex numbers, which will not be explained in this tutorial).
Strings
Strings are defined either with a single quote or a double quotes.
The difference between the two is that using double quotes makes it easy to include
apostrophes (whereas these would terminate the string if using single quotes)
Assignments can be done on more than one variable "simultaneously" on the same
line like this
a, b = 3, 4
print("Hello World")
name = “Python”
print("Hi there,", name)
number = 1 + 2 * 3 / 4.0
print(number)
Try to predict what the answer will be. Does python follow order of operations?
Another operator available is the modulo (%) operator, which returns the integer
remainder of the division. dividend % divisor = remainder.
remainder = 11 % 3
print(remainder)
squared = 7 ** 2
cubed = 2 ** 3
print(squared)
print(cubed)
print(name)
Output:
Python
Output:
John is 23 years old.