用户输入两个数M和N(用两个input语句输入),其中N是整数,计算M和N的5种数学运算结果,并依次输出,结果间用空格分隔。‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‪‬

5种数学运算分别是:‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‪‬

M与N的和、M与N的乘积、M的N次幂、M除N的余数、M和N中较大的值

实现

#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import math
from functools import reduce
#-----------------------
def returnMultipleResult(x,y):
    add=x+y
    mul=x*y
    #The result of this syntax will return a "float" data type.
    po=math.pow(x,y)
    #po=x**y
    extr=x%y
    ma=max(x,y)
    return add,mul,po,extr,ma
#main
def main():
    #i=0
    #temps=[0,0]
    a=0
    b=0
    result=(0,0,0,0,0)
    try:
        #while i<2:
           #temps[i]=float(input())
           #temps[i]=int(input())
           #i+=1
        #a=float(input())
        #b=int(input())
        a=eval(input())
        b=eval(input())
        #result=returnMultipleResult(temps[0],temps[1])
        result=returnMultipleResult(a,b)
        print(reduce(lambda x,y:x+' '+y,map(lambda x:str(int(x)),result)))
        #print(reduce(lambda x,y:x+' '+y,map(lambda x:str(round(x)),result)))
        #print(reduce(lambda x,y:x+' '+y,map(lambda x:str(x),result)))
    except Exception as e:
        print("The data's type of input is error!")
        print("Error:",e)
    except BaseException as e:
        print("The most basic exception is here:",e)
    finally:
        #test
        pass
#-------------------------
main()

输出

10
2
12 20 100 0 10

Q.E.D.


仰望星空,还需脚踏实地。