You should have C:\100 folder A shortcut to Python IDLE on desktop.

Slides:



Advertisements
Similar presentations
Getting Input in Python Assumes assignment statement, typecasts.
Advertisements

Intro to Python Welcome to the Wonderful world of GIS programing!
Functions. A set of statements (lines of code) that can be run repeatedly Goals: Learning Python by Lutz and Ascher –Code reuse –Procedural decomposition.
File Management and Organisation © Copyright William Rowan 2007.
Recitation 1 Programming for Engineers in Python.
Introduction to Python
Introduction to Computational Linguistics Programming I.
Python Lesson Week 01. What we will accomplish today Install Python on your computer Using IDLE interactively to explore String Variables if/else while.
 We are going to learn about programming in general…How to think logically and problem solve. The programming language we will use is Python. This is.
Using Publisher to Create a Web Site Mr. Sandford’s U. S. History Class.
You SHOUD HAVE.. C:\100 folder A desktop shortcut to “IDLE (Python34)”
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Moving files to the server You MUST save any files that you want to access in the future to the server. Go to “My Computer”. Select the “C” drive to see.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
PROGRAMMING In Lesson 2. STARTER ACTIVITY Complete the starter activity in your python folder – lesson 2 Now we will see how you got on and update your.
Variables, Expressions and Statements
ECS 15 Variables. Outline  Using IDLE  Building blocks of programs: Text Numbers Variables!  Writing a program  Running the program.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 17, 2015)
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
Make a dice challenge! This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Copy the code below in.
Asking the USER for values to use in a software 1 Input.
Python Let’s get started!.
Copy of the from the secure website - click on the AccoridaLife.zip link.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Introduction to Programming Python Lab 3: Arithmetic 22 January PythonLab3 lecture slides.ppt Ping Brennan
Introduction to Programming Python Lab 5: Strings and Output 05 February PythonLab5 lecture slides.ppt Ping Brennan
Introduction to Programming
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Input, Output and Variables GCSE Computer Science – Python.
What we learned so far Ask a question, and get a user input (in characters) If..else While for.
Introduction to Programming
An Interactive Tutorial for SPSS 10.0 for Windows©
Introduction to Programming
Fundamentals of Programming I Overview of Programming
Introduction to Programming
Introduction to Programming
Lesson 1 - Sequencing.
Introduction to Programming
Week 4 Computer Programming Gray , Calibri 24
Python Let’s get started!.
Advanced Coding Session 5
Introduction to Programming
Using Publisher to Create a Web Site
Introduction to Programming
Introduction to Programming
Thinking about programming
Introduction to Programming
Week 2 Computer Programming Learning Objective:
Teaching London Computing
Week 4 Computer Programming Year 9 – Unit 9.04
To Start Create C:\100 folder
Feedback Pace Different ideas for delivery Debugging strategies
Introduction to Programming
Introduction to Programming
Introduction to Programming
Section 1 Introduction To Programming
A look at Python Programming Language 2018.
Python Lesson’S 1 & 2 Mr. Kalmes.
Introduction to Programming
12th Computer Science – Unit 5
Introduction to Programming
More to Learn Creating a shortcut
Input and Output Python3 Beginner #3.
Introduction to Programming
The Python interpreter
Starter Which of these inventions is: Used most by people in Britain
CS 1111 Introduction to Programming Spring 2019
Presentation transcript:

You should have C:\100 folder A shortcut to Python IDLE on desktop

Recap Python has value types: int, float, str, boolean Variables vs. functions Both follow the naming convention Names are case-sensitive Lower-case first word, first letter capitalized in subsequent words A variable is assigned a value and hold it A function returns a value with a given argument

Input/Oupt Functions print(): print out the text in the argument input(): get Python ready to accept a response (nothing in argument) print(‘What is your age?’) myAge = input() What value will the variable myAge have ?

Past Lab 0907 Ask what the name is Ask what the major is Ask when you started the school Print “My name is …. studying ... from ....” >>> print(“What is your name?”) >>> myName = input() Kim >>> print (“What is your major?”) >>> myMajor = input() CS >>> print (“When did you start the school?” >>> myStartYr = input() 2000 >>> print(‘My name is ‘ + myName + ‘ studying ‘ + myMajor + ‘ from ‘ + myStartYr)

Programming in a File Python IDLE shell lets you write a program only once Need to save a program and reuse it later on Click on ‘File’ menu in IDLE, and select ‘New File’ A new file window opens up Enter the following instructions in the new window myName = input('Enter your name\n’) myMajor = input('Enter your major\n') myStartYr = input('Enter your start year\n’) print('My name is ' + myName + ' studying ' + myMajor + ' from ' +myStartYr)

How to run the program ? Click on menu ‘File’ and select ‘Save as’ Save the file under C:\100 with the name, test You should have a file C:\100\test.py Click on menu ‘Run’ and select ‘Run Module’ Back in IDLE window, the first query should show up Provide answers and see the final print() function prints out the sentence. myName = input('Enter your name\n’) myMajor = input('Enter your major\n') myStartYr = input('Enter your start year\n’) print('My name is ' + myName + ' studying ' + myMajor + ' from ' +myStartYr)

Review In the program, test.py, what are variables ? myName = input('Enter your name\n’) myMajor = input('Enter your major\n') myStartYr = input('Enter your start year\n’) print('My name is ' + myName + ' studying ' + myMajor + ' from ' +myStartYr) In the program, test.py, what are variables ? In the program, test.py, what are functions?

When to use IDLE and File Any programs to be reused or edited should be in files IDLE to test out a few instructions In IDLE, enter the following >>> myYr = input(‘What is your age? \n’) What is your birth year? 1990 >>> type(myYr)

HW1 – due on Wed class (9/14) Do problems 1, 2, 6, 7, 10 from Practice Questions in Chap. 1.

Lab 0909 Create a new file and write a program to ask your current age and print out your age in 5 year ? Namely, complete the print() function below: (Caution: the date type of the variable ‘myYr’ is a string.) myYr = input(‘What is your age? \n’) print(‘My age in the next 5 years will be ‘ Run your program, and email the screen shot to kim@cs.uml.edu