IST256 : Applications Programming for Information Systems

Slides:



Advertisements
Similar presentations
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Advertisements

An Introduction to Textual Programming
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
For loops in programming Assumes you have seen assignment statements and print statements.
More about Strings. String Formatting  So far we have used comma separators to print messages  This is fine until our messages become quite complex:
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
Decision Structures, String Comparison, Nested Structures
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
Magic 8 ball. "Design and write a python program that emulates a Magic Eight Ball. Your program should continually prompt the user to enter a question.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
Lesson 06: Functions Class Participation: Class Chat:
Lesson 12: Data Analysis Class Participation: Class Chat:
Lesson 03: Variables and Types
Exam #1 You will have exactly 30 Mins to complete the exam.
Recap: If, elif, else If <True condition>:
Lesson 08: Files Class Participation: Class Chat: Attendance Code 
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Lesson 07: Strings Class Chat: Attendance: Participation
Lesson 10: Dictionaries Topic: Introduction to Programming, Zybook Ch 9, P4E Ch 9. Slides on website.
Week of 12/12/16 Test Review.
Tuples and Lists.
Lesson 04: Conditionals Topic: Introduction to Programming, Zybook Ch 3, P4E Ch 3. Slides on website.
Active Learning Strategies For Your Classroom
IST256 : Applications Programming for Information Systems
More on Lists.
Lesson 05: Iterations Class Chat: Attendance: Participation
IST256 : Applications Programming for Information Systems
Lesson 07: Strings Topic: Introduction to Programming, Zybook Ch 6, P4E Ch 6. Slides on website.
JavaScript Functions.
IST256 : Applications Programming for Information Systems
IST256 : Applications Programming for Information Systems
For Monday Read WebCT quiz 18.
IST256 : Applications Programming for Information Systems
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Lesson 04: Conditionals Class Chat: Attendance: Participation
Lesson 08: Files Topic: Introduction to Programming, Zybook Ch 7, P4E Ch 7. Slides on website.
CSCE 206 Lab Structured Programming in C
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Lesson 09: Lists Topic: Introduction to Programming, Zybook Ch 8, P4E Ch 8. Slides on website.
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Teaching London Computing
For Wednesday No new reading No quiz.
G7 programing language Teacher / Shamsa Hassan Alhassouni.
IST256 : Applications Programming for Information Systems
Lesson 06: Functions Class Chat: Attendance: Participation
Lesson 09: Lists Class Chat: Attendance: Participation
Lesson 03: Variables and Types
Writing Functions( ) (Part 4)
Lesson 08: Files Class Chat: Attendance: Participation
Exercise Solution First questions What's output What's input
Lesson 10: Dictionaries Class Chat: Attendance: Participation
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
CS1110 Today: collections.
Python Basics with Jupyter Notebook
Introduction to Computer Science
Basic Lessons 5 & 6 Mr. Kalmes.
IST256 : Applications Programming for Information Systems
Introduction to Python
Lesson 02: Introduction to Python
Just Basic Lessons Mr. Kalmes.
CSCE 206 Lab Structured Programming in C
IST256 : Applications Programming for Information Systems
Lesson 07: Strings Class Chat: Attendance: Participation
More Basics of Python Common types of data we will work with
IST256 : Applications Programming for Information Systems
CMPT 120 Lecture 6 – Unit 1 – Chatbots
Presentation transcript:

IST256 : Applications Programming for Information Systems Python Data Types

Agenda Connection Activity Teaching: Practice Activity Review for Quiz Types: String, List String formatting Practice Activity Magic 8-Ball

Connect Activity Full-Contact Kahoot!: Let’s prepare for the quiz with a game of Kahoot! https://play.kahoot.it/#/?quizId=7be8749a-f5d8-42ef- 986f-5ba6b0e0baf9

Strings are Sequence Types Python strings are actually sequences of characters. Why is this important? You can index strings and retrieve sub-strings. Name = ‘Fudge’ Name[0]  ‘F’ Name[4]  ‘e’ Name.find(‘d’)  2

Lists are Sequence Types, too Python lists are variables which hold a collection of values. They are actually sequences of values. Why is this important? You can index lists and retrieve values. Lists can contain values of any type but the convention is they contain values of the same type. Grades = [‘A’,’A’,’C’,’F’] Grades[0]  ‘A’ Grades.index(‘C’)  2

Check Yourself: 30 Second Challenge X = “Python” Y = [“Programming”, “Is”, “Fun”] What is: X[3] ? Y[1] ? Y[0][1] ?

Watch Me Code Understanding Strings and Lists: Slice Notation Find() and Index()

Python Print Formatting Code Type Example Output %d Integer print(“%d” % 50) 50 %f Float print(“$%.2f” % 4.5) $4.50 %s String print(“[%s]” % ’mike’) [mike]

Watch Me Code Print Formatting

Python Packages: Random numbers Python has an extensive package system allowing us to add new functionality to our programs easily. Python packages contain one or more code files called modules. To use a module we must import it, one time: import random Rnd = random.randint(1,10) https://docs.python.org/3/library/random.html

Help me Code Tax Calculations! The country of “Fudgebonia” determines your tax rate from the number of dependents: 0  30% 1  25% 2  18% 3  10% Write a program to prompt for number of dependents (0-3) and annual income. It should then calculate your tax rate and tax bill. Format numbers properly!

Now You Code Magic 8 ball! https://en.wikipedia.org/wiki/Magic_8-Ball Build a Python list of 10 “fortunes” which answer yes/no questions. The user to asks a yes/no question, then return 1 of the 10 fortunes from the list at random. Criteria: Use Jupyter Notebook Work with a partner!

Conclusion Activity Use one word to describe class today