实现这一目标的最佳方法是什么:
user_input = ">"
if 2 user_input 3:
print("yes")
Run Code Online (Sandbox Code Playgroud)
我想避免写另一个if声明:
if user_input == ">":
if 2 > 3:
print("yes")
Run Code Online (Sandbox Code Playgroud) 我得到了这个号码1.12412,我想round it to 1.12415或1.12410 (muliple of 5 in last decimal)
如果使用该Round(X,4)功能,我会得到1.1241 (4 decimals).
有没有一个功能可以做到这一点?谢谢!
堆栈中有一个答案,但使用的是 c# 而不是 python