07.11.2019 21:21, Vladimir D. Seleznev ÐÉÛÅÔ: > ^ üÔÏÔ ÓÐÏÓÏ ÎÅ ÒÁÂÏÔÁÅÔ. îÉÖÅ ÐÅÒÅÞÉÓÌÅÎÙ ÉÚÍÅÎÅÎÉÑ ÓÄÅÌÁÎÎÙÅ ÕÔÉÌÉÔÏÊ 2to3 × ÄÁÎÎÏÍ ÐÁËÅÔÅ. --- ./mathomatic/primes/matho-sumšššššš 2019-11-07 22:34:48.543068658 +0300 +++ ./matho-sum 2019-11-07 22:42:52.909266580 +0300 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 š š# Python program to sum many large integers separated by spaces or newlines. š# The integers to sum may be entered on the command-line or into standard input. @@ -12,7 +12,7 @@ ššššššš # read stdin if no command line args ššššššš while True: ššššššššššššššš try: -šššššššššššššššššššššš input_line = raw_input() +šššššššššššššššššššššš input_line = input() ššššššššššššššš except: ššššššššššššššššššššššš break; ššššššššššššššš for s in string.split(input_line): @@ -21,4 +21,4 @@ ššššššš # sum together the command-line args ššššššš for arg in args: ššššššššššššššš sum += int(arg) -print sum +print(sum) --- ./mathomatic/primes/matho-multššššš 2019-11-07 22:34:48.543068658 +0300 +++ matho-multš 2019-11-07 22:42:35.634259521 +0300 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 š š# Python program to multiply many large integers separated by spaces or newlines. š# The integers to multiply may be entered on the command-line or into standard input. @@ -15,7 +15,7 @@ ššššššš # read stdin if no command line args ššššššš while True: ššššššššššššššš try: -šššššššššššššššššššššš input_line = raw_input() +šššššššššššššššššššššš input_line = input() ššššššššššššššš except: ššššššššššššššššššššššš break; ššššššššššššššš for s in string.split(input_line): @@ -24,4 +24,4 @@ ššššššš # multiply together the command-line args ššššššš for arg in args: ššššššššššššššš prod *= int(arg) -print prod +print(prod) --- ./mathomatic/primes/primorialšššššš 2019-11-07 22:34:48.544068659 +0300 +++ primorialšš 2019-11-07 22:42:58.551268884 +0300 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 š š# This is a Python program to display large primorials. š# A primorial is the product of all primes up to the given number. @@ -16,11 +16,11 @@ šimport sys š šdef usage(ev): -šššššš print "This program calculates large primorials." -šššššš print -šššššš print "Usage: %s integers" % os.path.basename(sys.argv[0]) -šššššš print -šššššš print "A primorial is the product of all primes up to the given number." +šššššš print("This program calculates large primorials.") +šššššš print() +šššššš print("Usage: %s integers" % os.path.basename(sys.argv[0])) +šššššš print() +šššššš print("A primorial is the product of all primes up to the given number.") ššššššš sys.exit(ev) š šdef output_primorial(arg): @@ -36,9 +36,9 @@ ššššššš for arg in args: ššššššššššššššš try: ššššššššššššššššššššššš if (int(arg) < 1): -šššššššššššššššššššššššššššššš print >>sys.stderr, "Number too small." +šššššššššššššššššššššššššššššš print("Number too small.", file=sys.stderr) ššššššššššššššššššššššššššššššš sys.exit(1) ššššššššššššššš except: -šššššššššššššššššššššš print >>sys.stderr, "Positive integer required." +šššššššššššššššššššššš print("Positive integer required.", file=sys.stderr) ššššššššššššššššššššššš usage(1) ššššššššššššššš output_primorial(arg) --- ./mathomatic/examples/factorialšššš 2019-11-07 22:34:48.538068656 +0300 +++ factorialšš 2019-11-07 22:43:04.379271266 +0300 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 š š# This is a Python program to display large factorials and test "fact.py". š @@ -8,13 +8,13 @@ šimport string š šdef usage(): -šššššš print "This program calculates large factorials." -šššššš print "Requires and tests \"fact.py\"." -šššššš print -šššššš print "Usage: %s integer_expressions" % os.path.basename(sys.argv[0]) -šššššš print -šššššš print "The integer expressions should be separated by spaces." -šššššš print "A factorial is the product of all positive integers <= a given integer." +šššššš print("This program calculates large factorials.") +šššššš print("Requires and tests \"fact.py\".") +šššššš print() +šššššš print("Usage: %s integer_expressions" % os.path.basename(sys.argv[0])) +šššššš print() +šššššš print("The integer expressions should be separated by spaces.") +šššššš print("A factorial is the product of all positive integers <= a given integer.") ššššššš sys.exit(2) š šargs = sys.argv[1:] @@ -23,8 +23,8 @@ šelse: ššššššš try: ššššššššššššššš num = eval(string.join(args)) -šššššššššššššš print "factorial(", num, ") =", factorial(num) +šššššššššššššš print("factorial(", num, ") =", factorial(num)) ššššššš except: ššššššššššššššš for arg in args: ššššššššššššššššššššššš num = eval(arg) -šššššššššššššššššššššš print "factorial(", num, ") =", factorial(num) +šššššššššššššššššššššš print("factorial(", num, ") =", factorial(num)) ïÞÅ×ÉÄÎÏ, ÞÔÏ ÉÚÍÅÎÅÎÉÑ ×ÅÒÎÙÅ. íÏÖÅÔÅ ÓÒÁ×ÎÉÔØ ÉÈ, ÎÁÐÒÉÍÅÒ, Ó Fedora: https://src.fedoraproject.org/rpms/mathomatic/tree/master þÔÏ ÉÍÅÎÎÏ × ÄÁÎÎÏÍ ÓÌÕÞÁÅ ÎÅ ÒÁÂÏÔÁÅÔ? > 2to3 × ÂÏÌØÛÉÎÓÔ×Å ÓÌÕÞÁÅ× _ÎÅ_ ÇÅÎÅÒÉÒÕÅÔ ÒÁÂÏÞÉÊ ËÏÄ. üÔÏ ÕÔ×ÅÒÖÄÅÎÉÅ ÔÒÅÂÕÀÝÅÅ ËÁËÉÈ-ÔÏ ÄÏËÁÚÁÔÅÌØÓÔ×. óÐÉÓÏË ×ÓÅÈ ÂÁÇÏ× ÐÏ 2to3: https://bugs.python.org/issue?%40search_text=&ignore=file%3Acontent&title=&%40columns=title&id=&%40columns=id&stage=&creation=&creator=&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=20&versions=&dependencies=&assignee=&keywords=&priority=&status=&%40columns=status&resolution=&nosy_count=&message_count=&%40group=&%40pagesize=50&%40startwith=0&%40sortdir=on&%40action=search äÁ, ÂÙ×ÁÀÔ ÎÀÁÎÓÙ. îÏ ÂïÌØÛÕÀ ÍÁÓÓÕ ËÏÄÁ ÔÒÁÎÓÆÏÒÍÉÒÕÅÔ É ÔÒÁÎÓÆÏÒÍÉÒÕÅÔ × ÒÁÂÏÞÉÊ Python3 ËÏÄ. > ÐÏÓÌÅ ËÁÖÄÏÇÏ > ÐÅÒÅ×ÏÄÁ ÉÈ ÎÁÄÏ ÐÒÏ×ÅÒÑÔØ. âÅÚÕÓÌÏ×ÎÏ (ÅÓÌÉ ÅÓÔØ ÐÏÎÉÍÁÎÉÅ ÉÚÍÅÎÅÎÉÊ), ÐÏÔÏÍÕ ÞÔÏ ÕÔÉÌÉÔÁ ÎÅ ÏÈ×ÁÔÙ×ÁÅÔ ×ÅÓØ ÆÕÎËÃÉÏÎÁÌØÎÙÊ ÓÐÅËÔÒ.