Python算法正常算法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python算法正常算法相关的知识,希望对你有一定的参考价值。

## 1、正常算法

```

if x < y:

    smaller = x

else:

    smaller = y

print (smaller)  

```


    

## 2、三元表达式

```

smaller = x if x<y else y

print (smaller)

```


##3、短路求值

```

smaller = x < y and x or y

print (smaller)

```











以上是关于Python算法正常算法的主要内容,如果未能解决你的问题,请参考以下文章