PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): 8 8 8 = 6.

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Advertisements

Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Introduction to Python
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Introduction to Programming Peggy Batchelor.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
August 29, 2005ICP: Chapter 1: Introduction to Python Programming 1 Introduction to Computer Programming Chapter 1: Introduction to Python Programming.
CPS120: Introduction to Computer Science Compiling Your Programs Using Visual C++
Python From the book “Think Python”
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 17, 2015)
Chapter Three The UNIX Editors.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
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.
Python Let’s get started!.
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.
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
5. Algorithm 1: Variables, Operators, Sequences 1.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
Fundamentals of Programming I Overview of Programming
Introducing Python Introduction to Python.
Development Environment
CST 1101 Problem Solving Using Computers
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Introduction to Computing Science and Programming I
Whatcha doin'? Aims: To start using Python. To understand loops.
Release Numbers MATLAB is updated regularly
A Playful Introduction to Programming by Jason R. Briggs
Python: Experiencing IDLE, writing simple programs
GCSE COMPUTER SCIENCE Practical Programming using Python
GCSE COMPUTER SCIENCE Practical Programming using Python
Python Let’s get started!.
Introduction to Python
Introduction to Python
Lesson 1 An Introduction
Guide To UNIX Using Linux Third Edition
Variables, Expressions, and IO
Basic operations in Matlab
Programming in Python For newbz.
Learning to program with Logo
Introduction to Python
Fill the screen challenge!
Week 1 Computer Programming Year 9 – Unit 9.04
Teaching London Computing
BSc in Digital Media, PSUIC
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Introduction to TouchDevelop
Section 1 Introduction To Programming
Introduction to Programming with Python
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
CS 1111 Introduction to Programming Spring 2019
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Beginning Python Programming
12th Computer Science – Unit 5
Chapter 1: Programming Basics, Python History and Program Components
Programming In.
Input and Output Python3 Beginner #3.
Chapter 1 Introducing Small Basic
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6

How to Problem Solve ■ ■The single most important skill for a computer scientist!!!!!!

Think like a computer programmer! ■This way of thinking combines some of the best features of mathematics, engineering, and natural science. Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations). Like engineers, they design things, assembling components into systems and evaluating tradeoffs among alternatives. Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.

Think Python! ■The programming language you will learn is Python. ■Python is an example of a high-level language; other high-level languages you might have heard of are C, C++, Perl, and Java.

Python Chapter 1 – Getting Started What is Python and why do we use it? ■Python is an easy to use programming language: you can use it to create web apps, games, and even a search engine. ■Developed by Guido van Rossum and released in 1991 ■Python got it’s name from the movie Monty Python ■Python is easy to use  Bridges the gap between programmers brain and the computer  Clear and simple rules make the language very close to English  Straightforward language – it has been called “programming at the speed of thought”  Programs are shorter and take less time to create

■Python is powerful  Used by companies such as Google, IBM, Microsoft, Verizon, Electronic Arts (EA Sports), Disney Interactive ■Python is a “glue” language ■Python runs everywhere  Can be integrated into other languages Java, C++, etc. ■Python is free!  Can install on any computer and not pay a penny!

Some Important Terminology Functions – like a mini program that goes off and performs a task. ■You kick off or call a function by using the function name, followed by a set of parenthesis. ■You can give or pass a function values to work with. ■These values, called arguments are put inside the parenthesis. Ex. Print (“Game Over”) displays Game Over function argument *Note: Python functions are case sensitive – Print works, PRINT won’t

String – series of characters ■A string can contain letters, numbers, and symbols. Ex: hello, 123abc, i love school Statement – a complete instruction Ex: print(“Game Over”)  In English, a statement is a complete thought, in Python it is a complete instruction. It does something. Programs are made up of a number of statements Code – programming statements

Color Coding ■Python uses color coding, called syntax highlighting, to help you understand what you have typed.  Function Purple  Strings Green  Output Blue

Introducing IDLE Python comes with an integrated development environment called IDLE. A development environment is a set of tools that makes writing programs easier. You can think of it as a word processor for your programs. IDLE provides two modes in which to work: an interactive mode and a script mode. Programming in Interactive Mode Time to write your first program! In this mode, you can tell Python what to do and it will respond immediately. Start up your Python Programs!

To begin: Start Menu > All Programs > Python 3.1 > IDLE (Python GUI) You should see a screen similar to this: This window is called the python shell These three arrows are a command prompt – ready for you to give instructions

■ At the command prompt type print(“Game Over”) and then press the Enter Key

TA-DA! You’ve just written your first Python program ■

■ The print() function can display text, surrounded by quotes, that you put inside the parenthesis. If you put nothing it will print a blank line. Function Output String called string literal, because it is literally the sequence of characters that make up that word

Generating an Error ■Computers take everything literally, if you misspell a function it will have no idea what you mean. Try typing: primt(“Game Over”)

Programming in Script Mode ■ Interactive mode gives you immediate feedback, but you can’t save programs and run them later. ■ In script mode you can write, edit, load, and save your programs. ■ Like a word processor for your code, you can even find and replace, and cut and paste.

Write your first program (again) ■ Type print(“Game Over”) and press Enter ■ Nothing happens! This is because you are writing a list of statements to be executed later. ■ Once you save your program, you can run it.

To save your program, select File > Save as. *For now just save it to your desktop ■ Give the program the name game_over.py *Make sure you save all programs with the.py extension. This allows various applications including IDLE to recognize these files as Python programs. ■ To run, select Run > Run Module ■ Notice your interactive window still contains old text from before ■ Try running the program from your desktop – double click it. ■ What happens?

We need to add a line to the end of all of our programs so that the program won’t close until the user hits enter. This line is input(“\n\nPress the enter key to exit.”) Now once the user presses the Enter key, the program exits and the console window will disappear. *Note: The computer ignores blank lines. These are just for humans reading code. Blank lines make programs easier to read, so use them when you write. Keep related code together and separate sections with a blank line

And finally, Using Comments ■ Can be written at any part in a program ■ Color code red ■ Computer ignores them – they are meant for humans ■ Help you remember the goal of your program and VERY useful to other programmers. ■ Create using a number sign symbol. – Ex: # Game Over # Demonstrates the print functions

■ Anything after this symbol (except in a string) on the rest of the line is a comment. ■ You should start all of your programs with a few comments – it is helpful to list the title and purpose of the program. You should also list the name of the programmer and the date the program was written. – Go back and add these comments to the beginning of your program End of Chapter 1!