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

python_1

The document provides a step-by-step guide for logging into a classroom computer and starting Python programming using Anaconda and Jupyter Notebook. It includes an introduction to Python's history, philosophy, syntax, and naming conventions for identifiers, along with reserved words and comment usage. Additionally, it offers links to Python tutorials for further learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

python_1

The document provides a step-by-step guide for logging into a classroom computer and starting Python programming using Anaconda and Jupyter Notebook. It includes an introduction to Python's history, philosophy, syntax, and naming conventions for identifiers, along with reserved words and comment usage. Additionally, it offers links to Python tutorials for further learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

When you come to classroom and your

computer …
• Login

• Start AppsAnyWhere from mst.edu

• Find and start Anaconda

• Find and start Jupyter Notebook

• Find your folder for this class practice

• Start a new python 3 file and


Name the file

Add your name and today’s date for your submission


Introduction to Python
Python
• Python was developed by Guido van Rossum in the late eighties and early
nineties at the National Research Institute for Mathematics and Computer
Science in the Netherlands
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).

Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.

Python 1.0 was released in November 1994. In 2000, Python 2.0 was released. Python
2.7.11 is the latest edition of Python 2.

Meanwhile, Python 3.0 was released in 2008.


Why Python?
• Philosophy behind python
Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Readability counts.
Python

https://
insights.stackoverflow.com/
survey/2018/#most-loved-
dreaded-and-wanted
How code works through computer

parser
Python Syntax
• How to make python understandable source code?
Proper identifier

Proper statements

Proper comment lines


Python Syntax
• Format for identifiers for variable, function, class, module or other object
• An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or
more letters, underscores and digits (0 to 9).
• Python does not allow punctuation characters such as @, $, and % within identifiers.
• Python is a case sensitive programming language.

• Python naming conventions for identifiers


• Class names start with an uppercase letter. All other identifiers start with a lowercase
letter.
• Starting an identifier with a single leading underscore indicates that the identifier is
private.
• Starting an identifier with two leading underscores indicates a strongly private identifier.
• If the identifier also ends with two trailing underscores, the identifier is a language-
defined special name.
Python Syntax
• Reserved words

add as assert break class continue def del


elif else except exec finally for from global
if import in is lambda not or pass
print raise return try while with
yield
Python Syntax file_finish = "end"
• Indentation is rigidly enforced file_text = ""
contents=[]
• The number of spaces in the indentation is variable, but all statements within the block
must be indented the same amount. file_name=input("Enter filename: ")
if len(file_name) == 0:
print("Please enter filename")
if True:
sys.exit()
print("Answer")
print("True")
try:
else:
if True: # open file stream
print("Answer")
print("True") file = open(file_name, "w")
print("False")
else:
print("False") except IOError:
print ("There was an error writing to", file_name)
sys.exit()

print ("Enter '", file_finish,)


print ("' When finished")
Python Syntax
• Multi-line statements using continuation character (\)
• Statements contained within the [], {}, or () do not need to use the line continuation
character.

days = ['Monday', 'Tuesday', 'Wednesday',


total = item_one + \ 'Thursday', 'Friday']
item_two + \
item_three
Python Syntax
• Quotation marks for strings: single (‘), double (“), and triple (‘’’ or “””) with
matched type

word = 'word'

sentence = "This is a sentence."

paragraph = """This is a paragraph. It is

made up of multiple lines and sentences."""


Python Syntax
• Comments: A hash sign (#) starts a comment line

• Multiple statements can be on a single line, use (;) to separate them

• Python files have extension .py


Python Tutorials
• https://docs.python.org/3/tutorial/index.html

• https://www.w3schools.com/python/

•https://www.tutorialspoint.com/python/ind
ex.htm

You might also like