Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1.

Similar presentations


Presentation on theme: "Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1."— Presentation transcript:

1 Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1

2 Python Named derived from TV series, Monty Python’s Flying Circus, not the snake Important goal of developers was to make it fun Common practice was to make Monty Python references in example code Created by Guido Van Rossum in 1991 Python is often compared to Tcl, Perl, Ruby, Scheme or Java Why use Python? General-purpose, interpreted high-level programming language Design philosophy emphasizes code readability Supports multiple programming paradigms object-oriented and to a lesser extent functional Can be used in a scripting or non-scripting context Python Lab #1Python Lab #1 2

3 Sample Python Script def greet (): print (“Hello, World!”) name = input (“Enter your name:”) if name == “Debbie”: print (“Hello, Debbie! I am glad that you are in CS192 today!”) else: print (“Hello”, name) greet() Python Lab #1Python Lab #1 3

4 Python Scripts Creating a Python Script Use a text editor such as gedit Name the file greet.py Write your script in greet.py Save greet.py T o run python program in terminal window, type: Python3.3 greet.py Python Lab #1Python Lab #1 4

5 Python Lab1 Assignment Type your own version of the python script What happens if you don’t use quotes around the first print statement? Take them off, try it, then put them back delete the tab in front of the first print statement? Try it, put it back remove the colon at the end of the first statement that begins with def? Try it, put it back Ask another question in your script Google a “while loop” Add a while loop to your Python Script Show your script to a lab instructor or helper Python Lab #1Python Lab #1 5


Download ppt "Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1."

Similar presentations


Ads by Google