CSci 150: Foundations of computer science
Home Syllabus Readings Projects Tests

printable version

Final Review B

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Problem RFb.1.

Suppose we have the Node class as defined earlier.

class Node:
    def __init__(selfvaluenext): = value = next

Assuming the variable head references the first Node in a list where each node contains a reference to a word, write a program fragment that counts how many of the words in the list have exactly four letters.