luckykitty: Cartoon avatar created on madmen site (Default)
luckykitty ([personal profile] luckykitty) wrote in [community profile] intro_to_cs 2009-11-14 09:03 pm (UTC)

Thank you for sharing your solution... My solution to problem 1 was really similar to yours! Except I didn't define it as a function, so had to include a flag for whether or not it was a prime and then test that afterwards. I really like having the function, as it makes it so much easier to read. Cool! *learns*

Could you also return True or False rather than 1 or 0, and then just test if is_prime is true? I guess it's six of one?

Post a comment in response:

This community only allows commenting by members. You may comment here if you're a member of intro_to_cs.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting