Lesson 02: Introduction to Python

Slides:



Advertisements
Similar presentations
Introduction to Python
Advertisements

INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Introduction to Computational Linguistics Programming I.
Input, Output, and Processing
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
CMSC201 Computer Science I for Majors Lecture 03 – Variables
Lesson 06: Functions Class Participation: Class Chat:
Lesson 03: Variables and Types
Exam #1 You will have exactly 30 Mins to complete the exam.
Topics Designing a Program Input, Processing, and Output
Lesson 08: Files Class Participation: Class Chat: Attendance Code 
FOP: User Input & Strings
Lesson 07: Strings Class Chat: Attendance: Participation
Lesson 10: Dictionaries Topic: Introduction to Programming, Zybook Ch 9, P4E Ch 9. Slides on website.
IST256 : Applications Programming for Information Systems
Lesson 13: Visualizations
Week of 12/12/16 Test Review.
Python Let’s get started!.
Introduction to Python
Lesson 02: Introduction to Python
Lesson 1 An Introduction
Lesson 05: Iterations Class Chat: Attendance: Participation
IF statements.
Variables, Expressions, and IO
Functions CIS 40 – Introduction to Programming in Python
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Learning to Program in Python
Lesson 13: Visualizations
Learning to Program in Python
Learning to Program in Python
Lesson 4: Controlling Memory with Variables
Lesson 04: Conditionals Class Chat: Attendance: Participation
Lesson 05: Iterations Topic: Introduction to Programming, Zybook Ch 4, P4E Ch 5. Slides on website.
Introduction to C++ Programming
IST256 : Applications Programming for Information Systems
An Introduction to Python
T. Jumana Abu Shmais – AOU - Riyadh
Lecture Notes 8/24/04 (part 2)
Hello World! Syntax.
Lesson 06: Functions Class Chat: Attendance: Participation
Variables and Expressions
Variables T.Najah Al_Subaie Kingdom of Saudi Arabia
Lesson 09: Lists Class Chat: Attendance: Participation
Lesson 03: Variables and Types
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Section 1 Introduction To Programming
Lesson 08: Files Class Chat: Attendance: Participation
Introduction In today’s lesson we will look at: why Python?
Lesson 10: Dictionaries Class Chat: Attendance: Participation
Topics Designing a Program Input, Processing, and Output
Python Basics with Jupyter Notebook
Topics Designing a Program Input, Processing, and Output
Just Basic Lessons 9 Mr. Kalmes.
Unit 3: Variables in Java
Introduction to Python
Python 10 Mr. Husch.
CMPT 120 Lecture 3 - Introduction to Computing Science – Programming language, Variables, Strings, Lists and Modules.
L L Line CSE 420 Computer Games Lecture #3 Introduction to Python.
Starter Which of these inventions is: Used most by people in Britain
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Lesson 07: Strings Class Chat: Attendance: Participation
Getting Started in Python
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Lesson 02: Introduction to Python Attendance: SU Connect | Code: ???? Class Chat: https://gitter.im/IST256/Fudge Participation http://ist256.participoll.com/

Questions? Ask in Our Course Chat! Agenda Programming: What, How and Why Thinking Like a Programmer The Python Programming Language DEMO: How we code in this course You’ve Read: Zybook Ch1 P4E Ch1 https://gitter.im/IST256/Fudge Questions? Ask in Our Course Chat!

Before We start: Where Is The Code!? Today I Will Write Code In Class. Please DO NOT Try To Type Along With Me! Watch Me Code. You’ll Learn More That Way. Trust Us. You Have The Code Already. https://github.com/IST256-classroom/fall2018-learn-python-mafudge

Connect Activity The python command to output information to the is: print output input get http://ist256.participoll.com/ A B C D

Recall:Computers & Algorithmic Thinking Most computer problems follow the input  Process  output model Data: raw unprocessed facts Information: meaningful, useful data Process (Program) Input (Data) Output (Information)

Learning Any Programming Language Process (Program) Input (Data) Output (Information) Learn how to output… Learn how to input… Learn how to process (transform input to output)

Output The built in function print() is used to display output. It takes one argument in single or double quotes known as a string literal. The string literal is enclosed in single or double quotes. Multiple string literals may be separated by a comma.

Watch Me Code 1 The built in print() function String literals Single and double quotes More than one argument Write this code in a Jupyter Notebook to demonstrate variables and types name = "Tony" age = 43 wage = 12.50 happy_employee = True print ("my name is",name," I am", age, "years old. I make ", wage, "Am I happy? ", happy_employee) GROK TYPES type(wage) etc… EXPLAIN THAT YOU CAN ALSO SWITCH TYPES OF VARIABLES Happy_employee = “You betcha!”

Activity: printing welcome Which statement prints welcome? print(welcome) print('welcome') print("welcome") Print([welcome]) A B C D

Input The built in function input() accepts input from the user. It takes one argument a string literal which prompts (provides instructions to the user). Input is commonly assigned to a variable so that the input can be used later on.

Watch Me Code 2 The built in input() function Using a prompt Storing into a variable Printing the variable Write this code in a Jupyter Notebook to demonstrate variables and types name = "Tony" age = 43 wage = 12.50 happy_employee = True print ("my name is",name," I am", age, "years old. I make ", wage, "Am I happy? ", happy_employee) GROK TYPES type(wage) etc… EXPLAIN THAT YOU CAN ALSO SWITCH TYPES OF VARIABLES Happy_employee = “You betcha!”

Activity: printing welcome For the following code, which is the prompt? x = input('y’) input 'y’ = x A B C D

Variables Variables are named areas of computer memory for storing data. The name can be anything but should make symbolic sense to the programmer. We write to the variable’s memory location with the assignment statement (=) We read from the variable by calling its name. Variable names must begin with a letter or _ and must only contain letters, numbers or _.

Watch Me Code 3 The built in inputs and outputs together Inputs and outputs into a program Prompts that change based on input, end=“” Write this code in a Jupyter Notebook to demonstrate variables and types name = "Tony" age = 43 wage = 12.50 happy_employee = True print ("my name is",name," I am", age, "years old. I make ", wage, "Am I happy? ", happy_employee) GROK TYPES type(wage) etc… EXPLAIN THAT YOU CAN ALSO SWITCH TYPES OF VARIABLES Happy_employee = “You betcha!”

End-To-End Example Mad-Libs!: Write a program to prompt to create a mad-libs type story generator in Python.

Conclusion Activity "One Important Thing" Name one important thing you learned in class today! Share it on Gitter.im chat now!