def fib(n): a, b = 0, 1 while a < n: print a, a, b = b, a+b print " " print "-" * 40 def thaHotSpot(kind, *arguments, **keywords): print "\n-- Do you have any", kind, "?" print "-- Yep, we have", kind for arg in arguments: print arg print "-" * 40 keys = sorted(keywords.keys()) for kw in keys: print kw, ":", keywords[kw] print "-" * 40 def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): # keywords: state, action, type with default values print "\n-- This parrot wouldn't", action, print "if you put", voltage, "volts through it." print "-- Lovely plumage, the", type print "-- It's", state, "!" fib(1000) thaHotSpot("Philly Cheesesteak", "It's Hella good!", "It's $4.75 and comes with fries and a drink!", shopKeeper = "John 'Two Fly' Jones", client = "Meat Head", sketch = "The Encounter") parrot('a million', 'bereft of life', 'jump') # 1 positional argument
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question