Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use one line of Python code to achieve some small functions

Shulou Source: shulou.com Published: 2022-06-03 09:22:36 10月03日 Update

This article mainly shows you "how to use a line of Python code to achieve some small functions", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use a line of Python code to achieve some small functions" this article.

1. Print the multiplication formula with one line of code

Print ('\ n'.join (['. Join (["% 2s x% 2s =% 2s"% (jjre iPersoniLigj) for j in range (1dint 1)]) for i in range (1meme 10)])

two。 One line of code to print the maze

Print ('. Join (_ _ import__ ('random'). Choice ('\ u2571\ u2572') for i in range (50 / 24)

3. One line of code to express love

Print ('\ n'.join (['.join) ([(' Love' [(Xmury)% len ('Love')] if) ((xpend0.05) * * 2 + (yellow0.1) * * 2-1) * * 3-(xpend0.05) * * 2* (yawp0.1) * * 3

Tags: One line code function content article study help multiplication formula easy to understand more organization love knowledge editing industry information information channel maze channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Docker macOS Shulou Tech Info