Skip to content

Commit

Permalink
revised question list.
Browse files Browse the repository at this point in the history
  • Loading branch information
xcao21 committed Jun 15, 2012
1 parent e9d117b commit dc8778e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 100+ Python challenging programming exercises.txt
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,23 @@ def checkValue(n):
checkValue(7)


#----------------------------------------#
Question:
Define a function that can accept an integer number as input and print the "It is an even number" if the number is even, otherwise print "It is an odd number".

Hints:

Use % operator to check if a number is even or odd.

Solution
def checkValue(n):
if n%2 == 0:
print "It is an even number"
else:
print "It is an odd number"


checkValue(7)



Expand Down

0 comments on commit dc8778e

Please sign in to comment.