Add Area
From CompSciWiki
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 |