180 likes | 208 Views
Learn about the fundamentals of computing science, problem-solving, algorithms, and programming in this introductory course. Become proficient in computer science by the end of the course.
E N D
CMPT 120 Lecture 2 - Introduction to Computing Science– Problem Solving, Algorithmand Programming
Last Lecture • Introducing the course • 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
Today’s Menu • Course Title: “Introduction to Computing Science and Programming 1” This slide is from our Lecture 1.
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?
Unit 0What 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 :)
1stpart of the course’s title: What is Computing Science? • Study of computation -> all aspects of problem solving • a.k.a. computational thinking Source: https://corporatetrainingmaterials.com/course/Creative_Problem_Solving https://www.sandler.com/blog/bring-problem-prospect-does
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
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
What is an algorithm? • A finitesequenced set of unambiguoussteps 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
More about algorithm • Video Algorithmsfrom Khan Academy
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 • Example– problem: compute final course grade 3. Use a flowchart • Example– problem: compute final course grade 4. In a diagram • Example– problem: build a shelving unit 5. In a video (verbal instructions and pictures) • Example– problem: make tea
Let’s give it a go! – Take 1 • Problem: • 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) algorithmsteps • 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.
Let’s give it a go! – Take 2 • Problem:
Today’s Review • How can I express an algorithm? • How would I display 4 + 7 = 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?
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