0% found this document useful (0 votes)
5 views

Python Lecture 1

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Python Lecture 1

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Lecture 1

Md. Samiul Islam


Assistant Professor, CSE,
State University of Bangladesh
Python!
• Created in 1991 by Guido van Rossum (now at Google)
 Named for Monty Python

• Useful as a scripting language


 script: A small program meant for one-time use
 Targeted towards small to medium sized projects

• 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

Note: For step by step installation


instructions, see the course web site.

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

You might also like