COSC 235: Programming and Problem Solving Ch. 2: Your first programs!!! Instructor: Dr. X.

Slides:



Advertisements
Similar presentations
While loops.
Advertisements

Computing Science Software Design and Development SOFTWARE DESIGN AND DEVELOPMENT USING PYTHON.
Programming Funamental slides1 Control Structures Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing Sequencing.
Arko Barman COSC 6335 Data Mining University of Houston.
Adapted from John Zelle’s Book Slides
Python Programming: An Introduction to Computer Science
CSC 110 Writing simple programs [Reading: chapter 2] CSC 110 C 1.
Vahé Karamian Python Programming CS-110 CHAPTER 2 Writing Simple Programs.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
17 March, 2000 CS1001 Lecture 2 Programming and problem solving Software engineering practices.
Chapter 2 Writing Simple Programs
Chapter 3 Planning Your Solution
INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Identifiers and Assignment Statements. Data structures In any programming language you need to refer to data The simplest way is with the actual data.
INLS 560 – V ARIABLES, E XPRESSIONS, AND S TATEMENTS Instructor: Jason Carter.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
CIS Computer Programming Logic
Programming.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Recursion Review.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
CS 127 Writing Simple Programs.  Stages involved  Analyze the problem  Understand as much as possible what is trying to be solved  Determine Specifications.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
COSC 235: Programming and Problem Solving Chapter 1: The magic of Python Instructor: Dr. X 1.
COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1.
1 CSC103: Introduction to Computer and Programming Lecture No 6.
Computer Science 101 Introduction to Programming.
Principles of programming languages 5: An operational semantics of a small subset of C Department of Information Science and Engineering Isao Sasano.
CHAPTER 4: CONTROL STRUCTURES - SEQUENCING 10/14/2014 PROBLEM SOLVING & ALGORITHM (DCT 1123)
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
Visual Basic Programming
Chapter 2: General Problem Solving Concepts
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.
Cosc175 - Define Problem/Design Solution/Pseudocode/Trace 1 DEFINE THE PROBLEM.
Introduction to Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
2. WRITING SIMPLE PROGRAMS Rocky K. C. Chang September 10, 2015 (Adapted from John Zelle’s slides)
Xiaojuan Cai Computational Thinking 1 Lecture 2 Simple Programs Xiaojuan Cai (蔡小娟) Fall, 2015.
CS201 Introduction to Sabancı University 1 Chapter 2 Writing and Understanding C++ l Writing programs in any language requires understanding.
Introduction to Computing Using Python Repetition: the for loop  Execution control structures  for loop – iterating over a sequence  range() function.
Computer Science 101 For Statement. For-Statement The For-Statement is a loop statement that is especially convenient for loops that are to be executed.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Chapter 2 Writing Simple Programs
Topic: Iterative Statements – Part 1 -> for loop
Python: Experiencing IDLE, writing simple programs
Python Programming: An Introduction to Computer Science
The Selection Structure
Think What will be the output?
Variables, Expressions, and IO
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Repetition: the for loop
Problem Solving and Programming CS140: Introduction to Computing 1 8/21/13.
CS190/295 Programming in Python for Life Sciences: Lecture 1
Introduction to Strings
Introduction to Strings
Programming Funamental slides
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
MSIS 655 Advanced Business Applications Programming
Programming Funamental slides
Computer Science Core Concepts
CS150 Introduction to Computer Science 1
Introduction to Strings
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Repetition: the for loop
Introduction to Strings
Introduction to Computer Science
The Python interpreter
Introduction to Strings
Presentation transcript:

COSC 235: Programming and Problem Solving Ch. 2: Your first programs!!! Instructor: Dr. X

Goals Understand Input Process Output (IPO) Use variables Understand expressions Use and understand iteration 2

Software Development Process Analyze Problem – what? Determine Specs - IO Create Design – how? Implement – make it Test/Debug – break it Maintain - …

Software Development Process

Program Elements Names Expressions Input/Output

Names Make them meaningful (descriptive) Camel case Use _ to connect two words Beware! – Symbols – Keywords – Case sensitive

Expressions Calculate new values Evaluate right hand side Assign to left! Spaces: are they important?

Output first… because it is easier Syntax print(,, …, ) print() Semantics: display information (data)

Input is a little tougher… Syntax = input( ) = eval(input( )) Semantics?

Assignment Syntax = Semantics? Have we seen this before?

Simultaneous assignment Syntax,, …, =,, …, Exercise: Write a sequence of assignment statements that exchange the values of thing1 & thing2

Exercise Print “Hello world” 10 times, then print it 100 times… Print the integer numbers from 0..10,

Loops org/wikipedia/commons/ thumb/f/f4/Shockwave_c oaster_sfot.jpg/220px- Shockwave_coaster_sfot.j pg eYwYLrlLWZs/UNlpG3goYgI/AAAA AAAACaI/MdQ2- CPcJYY/s1600/01.gif ookie.net/__cb /logopedi a/images/0/0a/Froot _Loops_logo.jpg

Loops Syntax for in : Semantics: avoid doing repetitive things using copy paste =) OR execute a definite sequence of steps

References “Python Programming: An Introduction to Computer Science”, 2 nd ed., John M. Zelle