ªð¦^¦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 : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD