Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / How do I output the exact same thing but with a while loop?   Code:   a = {"A":{"a", "b", "c"} ,"B":{"e", "f", "g"}, "C":{"h", "i,", "j"}} b = {} for aplha in a:     b[aplha] = len(a[aplha])     print(aplha)     print(b[aplha])     print(b)       Output: A 3 {'A': 3} B 3 {'A': 3, 'B': 3} C 3 {'A': 3, 'B': 3, 'C': 3}

How do I output the exact same thing but with a while loop?   Code:   a = {"A":{"a", "b", "c"} ,"B":{"e", "f", "g"}, "C":{"h", "i,", "j"}} b = {} for aplha in a:     b[aplha] = len(a[aplha])     print(aplha)     print(b[aplha])     print(b)       Output: A 3 {'A': 3} B 3 {'A': 3, 'B': 3} C 3 {'A': 3, 'B': 3, 'C': 3}

Computer Science

How do I output the exact same thing but with a while loop?

 

Code:

 

a = {"A":{"a", "b", "c"} ,"B":{"e", "f", "g"}, "C":{"h", "i,", "j"}}

b = {}

for aplha in a:
    b[aplha] = len(a[aplha])
    print(aplha)
    print(b[aplha])
    print(b)

 

 

 

Output:

A
3
{'A': 3}
B
3
{'A': 3, 'B': 3}
C
3
{'A': 3, 'B': 3, 'C': 3}

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions