Introduction to Python: Explore Python Labs

Slide Note
Embed
Share

In this Python Lab series, delve into the fundamentals of Python programming. Discover the origins of Python, its unique features, and how to create and run Python scripts. Engage in hands-on assignments to enhance your Python skills, including experimenting with print statements, loops, and more.


Uploaded on Sep 18, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. P y t h o n L a b # 1 1 Intro to Python Adriane Huber Debbie Bartlett

  2. P y t h o n L a b # 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

  3. P y t h o n L a b # 1 3 Sample Python Script def greet (): CS192 today! ) greet() print ( Hello, World! ) name = input ( Enter your name: ) if name == Debbie : print ( Hello, Debbie! I am glad that you are in else: print ( Hello , name)

  4. P y t h o n L a b # 1 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 To run python program in terminal window, type: lpython3.3 greet.py

  5. P y t h o n L a b # 1 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

Related


More Related Content