Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the Python code styles of different programmers?

Shulou Source: shulou.com Published: 2022-06-02 13:47:02 10月01日 Update

This article mainly explains "what are the Python code styles of different programmers". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the Python code styles of different programmers"?

A novice programmer

Def factorial (x): if x = = 0: return 1 else: return x * factorial (x-1) print factorial (6)

One year programming experience (Pascal)

Def factorial (x): result = 1 I = 2 while I 1 and x * fact (x-1) or 1 print fact (6)

Lazier Python programmers

F = lambda x: x and x * f (x-1) or 1 print f (6)

Python expert

Fact = lambda x: reduce (int.__mul__, xrange (2, x + 1), 1) print fact (6)

Python hacker

Import sys @ tailcall def fact (x, acc=1): if x: return fact (x.substitute substitute _ (1), acc.__mul__ (x)) return acc sys.stdout.write (str (fact (6)) +'\ n')

Expert programmer

Rom c_math import fact print fact (6)

British Imperial programmer

From c_maths import fact print fact (6)

Web designer

Def factorial (x): #-#-Code snippet from The Math Vault-Calculate factorial (C) Arthur Smith 1999-#- -- result = str (1) I = 1 # Thanks Adam while i

Tags: Programs programmers programming different code style experience learning experts content laziness people enterprises that is ideas situations articles novices more knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Huawei Shulou Technology NVidia