CMPT 120 Lecture 3 - Introduction to Computing Science – Programming language, Variables, Strings, Lists and Modules.

Slides:



Advertisements
Similar presentations
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Advertisements

CIS101 Introduction to Computing Week 09 Spring 2004.
Computer Science 101 Introduction to Programming.
Introducing Java.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Introduction to Python
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
CSC141 Introduction to Computer Programming
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Introduction to programming in the Java programming language.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
All materials copyright UMBC unless otherwise noted CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
CMSC201 Computer Science I for Majors Lecture 03 – Variables
Introducing Python Introduction to Python.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Development Environment
CST 1101 Problem Solving Using Computers
CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking Prof. Katherine Gibson Based on slides by Shawn Lupoli and Max Morawski at UMBC.
Topic: Introduction to Computing Science and Programming + Algorithm
Topic: Python’s building blocks -> Variables, Values, and Types
Topics Designing a Program Input, Processing, and Output
Topic: Programming Languages and their Evolution + Intro to Scratch
Programming Languages
Topic: Introduction to Computing Science and Programming + Algorithm
Learning to Program D is for Digital.
Topic: Python’s building blocks -> Statements
Introduction to Python
Chapter 3 GC 101 Java Fundamentals.
Topic: Python’s building blocks -> Variables, Values, and Types
Lesson 02: Introduction to Python
Beginning C++ Programming
Variables, Expressions, and IO
Thinking about programming
Functions CIS 40 – Introduction to Programming in Python
CS 240 – Lecture 11 Pseudocode.
Unit E Step-by-Step: Programming with Python
Introduction to the C Language
Chapter 10 Programming Fundamentals with JavaScript
What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:
Fill the screen challenge!
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Introduction to TouchDevelop
Language Basics.
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
T. Jumana Abu Shmais – AOU - Riyadh
Hello World! Syntax.
Algorithm and Ambiguity
Lesson 2 Get Started with Python – Post-Installation – Use the GUI.
Flowcharts and Pseudo Code
Topics Designing a Program Input, Processing, and Output
Tonga Institute of Higher Education IT 141: Information Systems
Topics Designing a Program Input, Processing, and Output
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 2 – part a Brent M. Dingle Texas A&M University
Basic Concepts of Algorithm
Introduction to Python
CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming.
CMPT 120 Lecture 15 – Unit 3 – Graphics and Animation
CMPT 120 Lecture 4 – Unit 1 – Chatbots
CMPT 120 Lecture 6 – Unit 1 – Chatbots
Lecture 5 – Unit 1 – Chatbots Python – More on Conditional statements
Lecture 20 – Practice Exercises 4
Lecture 20 – Practice Exercises 4
Year 8 Computer Science Digital Portfolio
Week 1 - Friday COMP 1600.
Presentation transcript:

CMPT 120 Lecture 3 - Introduction to Computing Science – Programming language, Variables, Strings, Lists and Modules

Weekly Exercise 1 - Show Case # Weekly Exercise 1: A Joke # Date: May 8th 2019 # ... # ... print("What do you call 8 Hobbits? A Hobbyte!") # Weekly Exercise 1 Joke # Date: May 8, 2019 # ... # ... print("You remind me of a software update; whenever I see you, I think 'Not now.'") #print a computer-related joke on the screen #May 8, 2019 #... # ... print("What's a computer's favourite snack?") print("Microchips!")

Weekly Exercise 1 - Feedback Marking criteria: Completeness Possible problems: Program does not load in Repl.it when click on link What was submitted was not a proper Repl.it link No header Incomplete header – missing name/description/author/date No algorithm/comments Syntax errors Joke not computer related <- semantic error

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 :)

Questions from Last Lecture Why do we need algorithms? How can I express an algorithm? How would I display 4 + 7 = 12 on the screen?

Questions from Last Lecture What do we put in a header and why? What would print("Above\nBelow") produce on the screen? What are the steps we performed when we solve a problem?

Review - Steps we perform when we program Design solution (algorithm) Problem statement Implement program Test

Homework - Activity - Human meets alien! Find a partner Decide which of you will play the part human and which will play the part of alien The alien has to be a really good alien. I mean, you need to imagine you’ve never been to Earth. You don’t know anything about what we do here. Food and drinks don’t exist on your planet. But what's cool is that you can communicate through a common language. It happens to be English. But you can only communicate with that language. No gesture. The human needs to explain how to drink a cup of coffee

Homework - Activity - Human meets alien! Observations

Unit 1 – Automation - Chatbots In this unit, we’ll learn about the computing science field of natural language processing, and its applications such as chat bots. We’ll learn about the basics of programming, through exercises (i.e., creating Python programs) loosely based on chatbots. Python: We’ll learn about comments, outputting to the screen, creating lists, working with text, and changing output depending on conditions.

What is a chatbot? Wiki: A chatbot is a computer program which conducts a conversation by processing text expressed in natural language. Some chatbots use sophisticated natural language processing systems. Simpler ones scan for keywords within the input, then pull a reply with the most matching keywords, or the most similar wording pattern, from a database.

Programming language This semester, we’ll be learning a new language What is a programming language? Definition: is a language that allows us to communicate with the computer, specifying detailed instructions that a computer can understand and execute A programming language, like a natural language, is made of Vocabulary (“building blocks”) Syntax rules (grammar) Python, C++, Javascript, etc, are programming languages

The first programmer In 1842, Lady Ada Lovelace wrote the first computer program for Charles Babbage's Analytical Engine (1837) Lovelace's notes made it clear that she understood the Analytical Engine as well as Babbage himself, and furthermore, she understood how to make it do the things computers do. She suggested the data input that would program the machine to calculate Bernoulli numbers, which is now considered the first computer program. But more than that, Lovelace was a visionary: she understood that numbers could be used to represent more than just quantities, and a machine that could manipulate numbers could be made to manipulate any data represented by numbers. She predicted that machines like the Analytical Engine could be used to compose music, produce graphics, and be useful to science. Of course, all that came true—in another 100 years. Source: https://en.wikipedia.org/wiki/Ada_Lovelace#/media/File:Ada_Lovelace_portrait.jpg http://collection.sciencemuseum.org.uk/objects/co62245/babbages-analytical-engine-1834-1871-trial-model-analytical-engines

Let’s review some concepts What is an advantage of compilers over interpreters? Python is an ____________________ language. What is an advantage of the high level languages over the low level languages? Which one (compiler or interpreter) produces object code? What would be a synonym of “source code”?

Let’s try our first chatbot! Problem Statement: Write a chatbot that can say Hi! and learn your name

About variables There are some constraints to how you can name your variables, e.g. Can contain letters, numbers, and underscores Should start with a letter (lowercase, by convention) They can't contain spaces or symbols They can't be one of the reserved keywords (see below for list) http://interactivepython.org/runestone/static/thinkcspy/SimplePythonData/VariableNamesandKeywords.html

Your turn! Problem Statement: Write a chatbot that can say hi and learn your name and … After the greetings, make the chatbot ask what your favourite music band is, and let you respond Then, the chatbot makes a comment about your response (but it cannot simply repeat what you have just said!)

Don’t forget to … Update your algorithm -> comments Translate them into Python Test your program

Let’s review some concepts How do you print in Python? What is the command or function to get input from the user? How do you concatenate two words in Python? How do you store an input from the user? What symbol do we use to assign a value to a variable? What is an example of a chatbot?

Let’s create another chatbot! Problem Statement: Write a chatbot that prints random cookie fortune statements

Let’s review some more concepts How do we make a list in Python? What module do we need to import to randomly choose something from a list? How can we test smaller pieces of our Python code? What is concatenation? What does a dot after a module name do? What is the only kind of symbol we can have in a variable name?

Next Lecture We shall practice using randomness in our programs We shall introduce branching A way to control the execution flow What’s that?