บรรทัดเดียวก็พอ #1 factorial
by Kowit on ก.ค..08, 2009, under Programming, Python
def fact(x): return (1 if x<1 else x * fact(x-1))
by Kowit on ก.ค..08, 2009, under Programming, Python
def fact(x): return (1 if x<1 else x * fact(x-1))
Use the form below to search the site:
Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!
All entries, chronologically...
กรกฎาคม 8th, 2009 on 7:01 pm
แหงะ บรรทัดเดียวจริง ๆ แต่หลาย statement นะ :p
กรกฎาคม 8th, 2009 on 7:12 pm
def q220ss(n):
return ‘\n’.join(['-'*((n+1)/2 - (i <= (n+1)/2 and i or 1 + n - i)) + '*'*((i 1) + '-'*((i 2 and (i <= (n+1)/2 and i or 1 + n - i) - 2 or 0) + '*'*((i <= (n+1)/2 and i or 1 + n - i) == 1) + '-'*((i 1) + '-'*((i 2 and (i <= (n+1)/2 and i or 1 + n - i) - 2 or 0) + '*'*((i 1) + '-'*((n+1)/2 - (i <= (n+1)/2 and i or 1 + n - i)) for i in range(1, n+1) ])
เล่นบ้างบรรทัดเดียวก็เกินพอ อยากรู้ว่าทำอะไรเอาไปรันเองนะครับ ^ ^