λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°

University of California, Berkeley/ElectricalEngineering & ComputerSciences

LAB_day 1

Welcome to 61A Lab

Lab 22 / Disc 112

TA : Chae Park

 

Attendance : links.cs61a.org/chae-lab

Announcements:

-      HW 0 is due Friday, June 28th

-      HW1 is due Tuesday, July 2nd

-      Lab1 is due Friday, June 28th

-      Project 1 will be released soon

-      OH has begun! @109 Morgan

Go to cs61a.org to see the schedule

 

Types of values

1. primitive : ex. 1, “hi”, 1.5, T/F

2. non-primitive ( objects ) : functions, lists …

Review of operators

% : remainder

// : floor (integer) division

Truth-y / False-y values:

Truth-y : 1, 2, 3, … , -3, True

False-y : 0, None, False, “ “, empty-list

Boolean Operator

1. not : negates truth-y / false-y ness

           ex. not 3 -> False

2. and : evaluates to first false-y or last truth-y value

           ex. 0 and 1 -> 0, 1 and 3 -> 3

3. or : evaluates to first truth-y value or last false-y value

           ex. 0 or 1 -> 1, 1 or 3 -> 1, 1 or 1/0 -> 1

Function

def Name ( Parameters ) :

           Body

ex. def add ( x, y ) :

           return x + y

To make a function call :

           function_name ( right arguments )

ex. add ( 2, 3 )

Controls

If-statements : allows us to skip lines of code based-on conditions

-      Format : if <condition> :

            <Body>

            elif <condition 2> :

            <Body 2>

            else :

            <Body 3>

While-statement : Allow us to repeat lines based-on conditions

-      Format : while <condition> :

            <Body>

'University of California, Berkeley > ElectricalEngineering & ComputerSciences' μΉ΄ν…Œκ³ λ¦¬μ˜ λ‹€λ₯Έ κΈ€

Week 2  (0) 2019.07.02
Environment Diagrams  (0) 2019.06.28
Control  (0) 2019.06.27
DISC  (0) 2019.06.27
Functions  (0) 2019.06.26