Python Lecture 1
Python Lecture 1
• Used by:
Google, Yahoo!, Youtube
Many Linux distributions
Games and apps (e.g. Eve Online)
2
Installing Python
Windows:
• Download Python from http://www.python.org
• Install Python.
• Pycharm, Visual Studio Code
3
Our First Python Program
• Python does not have a main method like Java
The program's main code is just written directly in the file
• Python statements do not end with semicolons
hello.py
1 print("Hello, world!")
4
The print Statement
print("text")
print() (a blank line)
Escape sequences such as \" are the same as in Java
Strings can also start/end with '
swallows.py
1 print("Hello, world!")
2 print()
3 print("Suppose two swallows \"carry\" it together.")
4 print('African or "European" swallows?')
5
Comments
• Syntax:
# comment text (one line)
swallows2.py
1 # Suzy Student, CSE 142, Fall 2097
2 # This program prints important messages.
3 print("Hello, world!")
4 print() # blank line
5 print("Suppose two swallows \"carry\" it together.")
6 print('African or "European" swallows?')
6
Thank You