You are on page 1of 2

CSCI 150 8/28/17

Origami reflections
One wrong step

Must be specific/precise

Unspoken/unshared assumptions (context)

Hard to put into words

Python
Numbers
int Stored exactly, no fractions

float Stored approximately, allows fractions

2.389 x 10^4 scientific notation tracks a fair number of significant digits, same with float not as
precise; therefore, computer scientists lean towards using integers over float. More precise.

Always have watch out for capitalizations.

Math
Lets say we need to figure out the volume of a box.

We will need width, height, and depth.

>>> Width = 10

>>> Height = 20

>>> Depth = 5

>>> Width * Height * Depth

1000

We need to present the code as if to a human audience.

Text
str String of characters

Quy each letter Q, u, y is a characterand each is a number in the code.

>>> ord(Q)

81
There is a table in the computer that recognizes each character as a number.

ord(a) checks for numerical value of one character

>>> ord (a)

97

Comparison

< checks for is it less than? or > checks for is it more than?

== checks for is it equal?

>>> width = input (What is the width)

What is the width>? 45

>>> width

45

You might also like