[Tutor] Python Question

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Jan 10 10:33:09 CET 2014


On 10/01/2014 00:11, Amy Davidson wrote:
> Hi,
>
> I am a university student who is struggling with writing functions in Python. I’ve been attempting to write a function in Python for over 2 hours with no progress. The function must be called, printID and take a name and student number as parameter and prints them to the screen.
>
> This is my closest guess:
>
> def print_ID(“Amy Davidson”, 111111111)

The def line should finish with a colon.  How do you expect to call this 
function for "Mark Lawrence", 1?  Research something like:- python 
functions parameters arguments.

> Student = “Amy Davidson”
> StudentN = 111111111
> print (“StudentName:”, Student)
> print (“StudentNumber:”, StudentN)

All four of your lines above should be indented, or have they been lost 
by your email client?  You simply assign to Student and StudentN which 
you then print.  Look closely at this, look back to my earlier comment, 
add them and hopefully the answer is 4 :)  Incidentally you'd usually 
spell them student and studentN.

>
> If you could help correct my work and explain, that would be great!
>
> Thanks,
>
> Amy Davidson


-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list