2018-02-09 HW

posted Feb 9, 2018, 6:20 AM by Konstantinovich Samuel   [ updated Feb 13, 2018, 3:57 AM ]
HW - New Problems on codngbat:   Looping Over Digits

Do Now: (On paper, do not use the computer!)
Evaluate each expression:
a) 3 / 4
b) 3 / 4.0
c) 16 % 5
d) 5 % 16
e) How can you look at the last (rightmost) digit of an integer? How about the second to last digit?
f) Would this pattern help you get any digit? Explain!

Write a function takes a single non-negative integer, and then prints each of the digits one at a time from right to left:

formal parameter - the identifier used in a function to stand for the value that is passed into the method by a caller. For example, x is a formal parameter of sqrt in this example:

def sqrt(x):

actual parameter - the (actual) value that is passed into the function by a caller. For example, the 200 used when sqrt(200) is called is an actual parameter. actual parameters are often called arguments

Discussion of a few older problems