Download presentation
Presentation is loading. Please wait.
Published byClifford Wilson Modified over 9 years ago
1
COSC 235: Programming and Problem Solving Ch. 2: Your first programs!!! Instructor: Dr. X
2
Goals Understand Input Process Output (IPO) Use variables Understand expressions Use and understand iteration 2
3
Software Development Process Analyze Problem – what? Determine Specs - IO Create Design – how? Implement – make it Test/Debug – break it Maintain - …
4
Software Development Process https://opensw.files.wordpress.com/2009/07/software_development1.jpg
5
Program Elements Names Expressions Input/Output
6
Names Make them meaningful (descriptive) Camel case Use _ to connect two words Beware! – Symbols – Keywords – Case sensitive
7
Expressions Calculate new values Evaluate right hand side Assign to left! Spaces: are they important?
8
Output first… because it is easier Syntax print(,, …, ) print() Semantics: display information (data)
9
Input is a little tougher… Syntax = input( ) = eval(input( )) Semantics?
10
Assignment Syntax = Semantics? Have we seen this before?
11
Simultaneous assignment Syntax,, …, =,, …, Exercise: Write a sequence of assignment statements that exchange the values of thing1 & thing2 http://www.cliparthut.com/thing-1-and-2-dr-seuss-clipart-UnZOY3.html
12
Exercise Print “Hello world” 10 times, then print it 100 times… Print the integer numbers from 0..10, 0..100
13
Loops https://upload.wikimedia. org/wikipedia/commons/ thumb/f/f4/Shockwave_c oaster_sfot.jpg/220px- Shockwave_coaster_sfot.j pg http://3.bp.blogspot.com/- eYwYLrlLWZs/UNlpG3goYgI/AAAA AAAACaI/MdQ2- CPcJYY/s1600/01.gif http://img1.wikia.noc ookie.net/__cb20110 112235951/logopedi a/images/0/0a/Froot _Loops_logo.jpg
14
Loops Syntax for in : Semantics: avoid doing repetitive things using copy paste =) OR execute a definite sequence of steps
15
References “Python Programming: An Introduction to Computer Science”, 2 nd ed., John M. Zelle
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.