Compsci 101, couples same name length
This exercise is for collaborative work during class. Do not fill out early!
Sign in to Google to save your progress. Learn more
Consider the Python code below
A = "jeff ron terry chris joe kelley tom".split()
B = "valerie brook mary pat jill".split()

# first nested loop  
for aname in A:
    for bname in B:
        if len(aname) == len(bname):
            print aname + ", " + bname

print
# second nested loop
for bname in B:
    for aname in A:
        if len(aname) == len(bname):
            print aname + ", " + bname

Which of the following are true about the two nested for loops above? *
Required
How does one rewrite the first nested loop with just one 'for' loop? *
Required
Names and Netids below
Names (comma separated) *
netid *
netid (partner)
netid (partner)
netid (partner)
Submit
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy