9
Oct

Is Friend – Intro to Computer Science


Your goal for this quiz is to define a procedure, is_friend, that takes a string as its input, and outputs a Boolean value indicating if the input string is the name of a friend. This would be very hard to do, in general, but we’re going to assume that I have a very strict policy on friends. I’m friends with everyone whose name begins with the letter “D”–and no one else. So if the input name begins with the letter “D”, your procedure should output True; otherwise, it should output False. So, for example, if we did: print is_friend(‘Diane’), the output should be True and if we did: print is_friend(‘Fred’), you should see the output False.

Tags: , , , , , , ,

There are no comments yet

Why not be the first

Leave a Reply

Your email address will not be published. Required fields are marked *