Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Tracing

Tracing:

def output1(num1, num2, num3):

  count = 0

  if num1 < 20 and num2 > 10:
    print "1st one" + str(num1 + 10)

  for i in range(1, num1, 3):
    count += 1

  count -= 2
  print count
  print count - num3

REMOVEDnction call:
>>> output1(20, 3, 12)
What would print out with this function call?


Tracing:
def check(value):

  for i in range(1, value):
    if i + 5 > value:
      print "True"

REMOVEDnction call:
>>> check(7)
What would print out with this function call?



Tracing:
def addD(num):
  if num < 10:
    return num
  else:
    return num % 10 + addD(num/10)

Warning – This is a recursive function
>>addD(12345)
What would print out with this function call?



Questions- Final Exam Review Sp2007