Difference between revisions of "Add Area"
From CompSciWiki
m |
m (Added a semicolon "The skeleton structure will be like this:") |
||
Line 14: | Line 14: | ||
|SideSection= | |SideSection= | ||
|Solution= | |Solution= | ||
− | The skeleton structure will be like this | + | The skeleton structure will be like this: |
{{CodeBlock | {{CodeBlock | ||
|Code= | |Code= |
Latest revision as of 21:33, 4 April 2012
Back to the Program-A-Day homepage
ProblemWrite a function that has two parameters. It will return the conbination of the two parameters.
|
Introducing Functions | |
---|---|---|
SolutionThe skeleton structure will be like this: def combineNumber(areaCode, phoneNumber): return result def main(): main() We can start to write the combineNumber function def conbineNumber(areaCode, phoneNumber): areaCode = areaCode * 10000000 result = areaCode + phoneNumber return result We can finish the main function def main(): temp = combineNumber(204, 8998810) print temp main() | ||
Code |