# User Instructions # # Write a function 'sub_m' that takes a # name and a nickname, and returns a # string of the following format: # "I'm NICKNAME. My real name is NAME, but my friends call me NICKNAME." # given_string2 = "I'm %(nickname)s. My real name is %(name)s, but my friends call me %(nickname)s." def sub_m(name, nickname): return given_string2 % {"name":name, "nickname":nickname} # sub_m("Mike", "Goose") # => "I'm Goose. My real name is Mike, but my friends call me Goose."
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