[Tutor] Positional Arguments
Mark Lawrence
breamoreboy at yahoo.co.uk
Fri Nov 1 23:46:33 CET 2013
On 01/11/2013 18:43, Jenny Allar wrote:
> gethours() #Call the function that gets the hours worked payrate
You throw away hrswrkd and payrate from gethours here
> print()
> calcandprint() # Call the function that calculates and prints the
Then you call calcandprint with no arguments at all, but you've defined
it to take two, hence your error below. So:-
hrswrkd, payrate = gethours()
print()
x, y = calcandprint(hrswrkd, payrate)
etc.
> def calcandprint (hrswrkd, payrate):
> Error:
>
> Traceback (most recent call last):
> File "C:\", line 93, in <module>
> main()
> File "C:\", line 15, in main
> calcandprint() # Call the function that calculates and prints the
> information
> TypeError: calcandprint() missing 2 required positional arguments:
> 'hrswrkd' and 'payrate'
> Again, thank you.
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
More information about the Tutor
mailing list