Tutorial 02
Tutorial 02
+, -, *, /, %
DATA TYPES
In Python, all data has an associated data “Type”.
You can find the “Type” of any piece of data by
using the type() function:
type(‘Hi’)
type(True)
int & float
int(“7”) produces 7
variables.
When a variable is evaluated, it produces the
prints 314.15
USER INPUT
We can instruct Python to name = input(‘Who are you? ’)
pause and read data from the print('Welcome', name)
string
CONVERTING USER INPUT
If we want to read a number inp = input(‘Europe floor?’)
from the user, we must usf = int(inp) + 1
convert it from a string to a print('US floor', usf)
number using a type
conversion function Europe floor? 0
Later we will deal with bad US floor 1
input data
FLOW CHARTS &
PSEUDOCODE
PROGRAMMING TOOLS
Flowchart
Pseudocode
FLOWCHARTS
START
END
BASIC FLOWCHART SYMBOLS
Input/ Output Operations
represented by parallelograms
indicate an input or output operation
BASIC FLOWCHART SYMBOLS
Processes
represented by rectangles
indicates a process such as a mathematical computation or
variable assignment
PSEUDOCODE
Uses English-like phrases to outline the task in
an algorithm
COMMENTS
As programs get bigger and more complicated, they