ãªã¹ãå
å
表è¨ï¼LCï¼ä½¿ã£ãæ¹ãå§åçã«ã³ã¼ããèªã¿ããããçããªããæ
£ãã¦ãªãã¨ããçç±ã§ä½¿ããã¦ãªãæ°ãããã®ã§ä»å¾ã®èªåã®ããã«ããã¡ã¢ãæ®ãã LCã¯åºæ¬çã«ãListãHashãå¦çããéã«ä½¿ç¨ããããä¾ãã°ãè¦åæ§ã®ãã並ã³ã®Listã欲ããæãªã©ã«å©ç¨ããã¨è¯ãã 1, åºç¤ ãªã¹ãã®ä½æ forã®åãå¦çãforããListåã¾ã§ãã²ã¨ã¤ã®forã®æ®µè½ã§åããè©ä¾¡ãããã src_list = [1,2,3,4,5] print [x for x in src_list] # [1,2,3,4,5] ãªã¹ãã®ä½æ2 foré¨ã§åãåºãããè¦ç´ ãããã®å¾ãifé¨ã§è©ä¾¡ããçã ã£ããã®ã ãããåãã®ï½ï¼ï¼ã«æ¸¡ããå¦çãããï¼ãã®å ´åã¯ãï¼ï¼ï¼ã ãï¼ src_list = [1,2,3,4,5] print [x*2 for x in src_list if x % 2 == 0
{{#tags}}- {{label}}
{{/tags}}