Python Forum
Trouble with LPtHW exercise 21
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with LPtHW exercise 21
#3
The def statement is where the functions are defined. For age = add(30, 5) you say it's defined but not called. But it is called. That's how you call the add function: with parameters in parentheses. That causes the add function to print it's message, and the return value is stored in age. Then that age variable is used in the print statement using the results. The % operator for strings allows for inserting values into strings. The first %d in the string is replaced by the first value in the tuple. The 'd' in '%d' indicates the format (digits). Then the second %d is replaced by the second value in the tuple, and so on.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Trouble with LPtHW exercise 21 - by pyth31 - Sep-09-2017, 12:12 PM
RE: Trouble with LPtHW exercise 21 - by snippsat - Sep-09-2017, 12:28 PM
RE: Trouble with LPtHW exercise 21 - by ichabod801 - Sep-09-2017, 01:16 PM
RE: Trouble with LPtHW exercise 21 - by pyth31 - Sep-09-2017, 02:52 PM
RE: Trouble with LPtHW exercise 21 - by ichabod801 - Sep-09-2017, 04:50 PM
RE: Trouble with LPtHW exercise 21 - by pyth31 - Sep-09-2017, 07:46 PM
RE: Trouble with LPtHW exercise 21 - by Larz60+ - Sep-09-2017, 06:12 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020