Photo by Fort Photo, "Fountains of Light" èªåã®ããã«ã¡ã¢ãpythonã§ã½ã¼ããè¡ããã¨ããå ´åããªã¹ãã«çµã¿è¾¼ã¾ãã¦ããé¢æ°list.sort()ã¨ãåç¬ã§ä½¿ããé¢æ°sorted()ã®2ã¤ããããåºæ¬çã«åãå¼æ°ã¯åããªã®ã§æ©è½èªä½ã¯ãã¾ãå¤ãããªãã®ã ãã以ä¸ã®2ç¹ãç°ãªãã sort()é¢æ°ã¯è¿ãå¤ãåºããã«ããªã¹ãã®æ¬ä½èªä½ãå¤æ´ãã¦ãã¾ããããã¯reverse()é¢æ°ã¨åãã sort()é¢æ°ã¯ã½ã¼ãã®å¯¾è±¡ããªã¹ãã§ããã®ã«å¯¾ããsorted()é¢æ°ã¯å¯¾è±¡ãã¤ãã¬ã¼ã¿ã¨ãªãã 試ãã«pythonä¸ã§ç¢ºèªãã¦ã¿ãã >>> x = [1,6,3,8,4] >>> y = [1,6,3,8,4] >>> y.sort() >>> y [1, 3, 4, 6, 8] >>> sorted(x) [1, 3, 4, 6, 8] ãã¡ãã¨ä¸¡æ¹ã¨ã
{{#tags}}- {{label}}
{{/tags}}