Python တွင် dictionary မှ အရာအားလုံးကို ဖျက်ခြင်း

Dictionary မှ အရာအားလုံးကို clear method ကိုသုံး၍ ဖျက်နိုင်ပါသည်:

pythondct = {
  'a': 1,
  'b': 2,
  'c': 3
}

dct.clear()
print(dct) # ရလဒ် {}
Задание 1

Dictionary ပေးထားပါသည်:

pythondct = {
  'x': 1,
  'y': 2,
  'z': 3
}

၎င်းကို ရှင်းလင်းပါ။

Задание 2

အောက်ပါ code ကိုပေးထားပါသည်:

pythondct = {
  1: 'text1',
  2: 'text2',
  3: 'text3'
}

dct.clear()
dct[4] = 'text4'
print(dct)

console တွင် ဘာထွက်လာမည်ကို ပြောပြပါ။