Multiplication on command line terminal

后端 未结 8 1907
有刺的猬
有刺的猬 2020-12-04 08:00

I\'m using a serial terminal to provide input into our lab experiment. I found that using

$ echo \"5X5\"

just returns a string of \"

8条回答
  •  遥遥无期
    2020-12-04 08:26

    If you like python and have an option to install a package, you can use this utility that I made.

    # install pythonp
    python -m pip install pythonp
    
    pythonp "5*5"
    25
    
    pythonp "1 / (1+math.exp(0.5))"
    0.3775406687981454
    
    # define a custom function and pass it to another higher-order function
    pythonp "n=10;functools.reduce(lambda x,y:x*y, range(1,n+1))"     
    3628800
    

提交回复
热议问题