Difference between revisions of "Add Area"
From CompSciWiki
m |
|||
Line 6: | Line 6: | ||
Example: | Example: | ||
<BR> | <BR> | ||
− | combineNumber(204, 8998810) | + | combineNumber(204, 8998810) |
<BR><BR> | <BR><BR> | ||
Output: | Output: |
Revision as of 01:22, 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 |