Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming.

Similar presentations


Presentation on theme: "CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming."— Presentation transcript:

1 CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming

2 Last Lecture Introducing the course Little activity -> Thank you!
What is this course all about? All we need is … How is this course going to work? Little activity -> Thank you! Our first program! Q&A Summary

3 Today’s Menu Course Title: “Introduction to Computing Science and Programming 1” This slide is from our Lecture 1.

4 Reading Review What is the single most important skill for a computer scientist? Comments and ________ ________ can make your programs much easier for humans to parse. Use them liberally! What is the difference between a natural language and a formal language?

5 Unit 0 What is Computing Science?
In the first week, we'll talk about what computing science is, where it comes from, why it's awesome, and start to learn about how it works. You'll get set up with the tools that we'll be using in this class to help you become proficient computer scientists by the end of this course. By the way, in computing, we count from 0 :)

6 1st part of the course’s title: What is Computing Science?
Study of computation -> all aspects of problem solving a.k.a. computational thinking Source:

7 BTW: Computing or Computer Science?
“Computing science is as much about computers as astronomy is about telescopes." From wiki: “Despite its name, a significant amount of computer science does not involve the study of computers themselves.” Computer: a tool Computing: field of study

8 Activity – Solving a Problem
What are the steps we go through when we solve a problem? Take 5 minutes to … Pair up Pick a problem you both have experienced Identify the steps you go through when you solved your problem

9 Steps of Problem Solving

10 What is an algorithm? A finite sequenced set of unambiguous steps that, once executed, produces a result Finite: This set of steps executes in a finite amount of time i.e. it should finish at some point Sequenced: The steps must be executed in the order in which they are listed Unambiguous: Each step is clear Result: This result solves the initial problem The algorithm also describes The data it needs in order to work -> input The result it produces -> output

11 More about algorithm Video Algorithms from Khan Academy

12 Activity - Human meets alien!

13 How do we express an algorithm?
1. Use a natural language like English Example – problem: compute final course grade 2. Use a mix of natural language and computer language -> pseudocode 3. Use a flowchart 4. In a diagram Example – problem: build a shelving unit 5. In a video (verbal instructions and pictures) Example – problem: make tea

14 Let’s give it a go! – Take 1 Problem: Solution:
Display a greeting on the screen Solution: Algorithm in English Comments Write your 1) header block with a title, a general description of what you’re trying to do, author and date 2) algorithm steps All lines should be preceded by a ________ Code Translate your algorithm into Python using a new addition to our vocabulary: print. Note the parentheses and quotation marks. These are necessary.

15 Let’s give it a go! – Take 2 Problem:

16 Why do we need algorithms?

17 Today’s Review How can I express an algorithm?
How would I display = 12 on the screen? What are the steps we performed when we solve a problem? What do we put in a header? What would print("Above\nBelow") produce on the screen? Give an example of an algorithm?

18 Next Lecture Introduce Unit 1 – Automation – Chatbots
Can we build chatbots using what we know of Python so far, i.e., print, variables, strings input, lists, modules, etc…? We shall see 


Download ppt "CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming."

Similar presentations


Ads by Google