QUESTION DATED : 06/12/2024

(Question Code : QC24120600)

  BUILD UP TWO DICTIONARY,  IF THE DICTIONARY IS EMPTY PRINT "DICTIONARY IS EMPTY" OTHERWISE PRINT "DICTIONARY IS NOT EMPTY" .  


      ANSWER


a = {}

while True:

    i = input("Enter the key for 1st Dictionay(type stop when all keys are added):")

    if i.lower() == 'stop':

        break

    j = input("Enter the value for 1st Dictionay:")

    a[i] = j


b = {}

while True:

    i = input("Enter the key for 2nd Dictionay(type stop when all keys are added):")

    if i.lower() == 'stop':

        break

    j = input("Enter the value for 2nd Dictionay:")

    b[i] = j


if not a:

    print("First dictionary is empty.")

else:

    print("First dictionary is not empty.")


if not b:

    print("Second dictionary is empty.")

else:

    print("Second dictionary is not empty.")

                                                                      -----


No comments:

Post a Comment

APPLICATIONS

Support Us Help us create more useful apps! We've already built a screen recorder(availabe in APPS...