python1~10阶乘while_Python3基础 while 阶乘
?
python : 3.7.0
OS : Ubuntu 18.04.1 LTS
IDE : PyCharm 2018.2.4
conda : 4.5.11
type setting : Markdown
?
code
"""
@Author : 行初心
@Date : 18-9-24
@Blog : www.cnblogs.com/xingchuxin
@GitHub : github.com/GratefulHeartCoder
"""
def main():
count = int(input(‘你要求幾的階乘:‘))
res = 1
while True:
res = res * count
count = count - 1
if count == 1:
break
print(res)
if __name__ == ‘__main__‘:
main()
?
result
/home/coder/anaconda3/envs/py37/bin/python /home/coder/PycharmProjects/basic/demo.py
你要求幾的階乘:5
120
Process finished with exit code 0
?
resource
[文檔] https://docs.python.org/3/
[規(guī)范] https://www.python.org/dev/peps/pep-0008/
[規(guī)范] https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules/
[源碼] https://www.python.org/downloads/source/
[ PEP ] https://www.python.org/dev/peps/
[平臺(tái)] https://www.cnblogs.com/
?
Python具有開源、跨平臺(tái)、解釋型、交互式等特性,值得學(xué)習(xí)。 Python的設(shè)計(jì)哲學(xué):優(yōu)雅,明確,簡單。提倡用一種方法,最好是只有一種方法來做一件事。 代碼的書寫要遵守規(guī)范,這樣有助于溝通和理解。 每種語言都有獨(dú)特的思想,初學(xué)者需要轉(zhuǎn)變思維、踏實(shí)踐行、堅(jiān)持積累。
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的python1~10阶乘while_Python3基础 while 阶乘的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: “昏昏磴路深”下一句是什么
- 下一篇: python实现胶囊网络_胶囊网络 --