ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

Python µ{¦¡½d¨ÒºÃ´b?

Python µ{¦¡½d¨ÒºÃ´b?

¤j®a¦n, ¥Ø«e¥¿¦b¦Û¾Çpython,¤U­±ªº½d¨Ò1«Ü¦n²z¸Ñ
¦ý½d¨Ò2ªºµ²ªG½Ö¯àÀ°¦£¸ÑÄÀ¤@¤U¬°¦óµ²ªG¤£¬O§Ú©Ò·Qªº
{ 0+0*0 , 1+1*1 , 2+2*2.....9+9*9........} = {0, 2, 6, 12, 20, 30, 42, 56, 72.....90}

EX.1
testDic = {i: i * i for i in range(10)}
print(testDic)
ANS: {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}

EX.2
testDxc = {i+ i * i for i in range(10)}
print(testDxc)
ANS: {0, 2, 6, 72, 42, 12, 20, 56, 90, 30}

ÁÂÁÂ

¶°¦Xª«¥ó¬OµL§Ç¡A¦pªG»Ý­n¦³§Ç..
  1. for i in range(10):
  2.     print(i+i*i)
½Æ»s¥N½X

TOP

­ì¨Ó¦p¦¹....ÁÂÁÂ

TOP

EX.1
testDic = {i: i * i for i in range(10)}
print(testDic)
ANS: {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}
¡÷ testDic¸ê®Æ¬Odict , dict¬O¦³¶¶§Çªº¤@²Õ¸ê®Æ

EX.2
testDxc = {i+ i * i for i in range(10)}
print(testDxc)
ANS: {0, 2, 6, 72, 42, 12, 20, 56, 90, 30}
¡÷ testDic¸ê®Æ¬Oset , set¬O¨S¦³¶¶§Çªº¤@²Õ¸ê®Æ , ©Ò¥H¤£·|·Ó0 ~ 9ºâ¥Xªºµ²ªG§@±Æ¦C
MLB

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD