Monday, 19 September 2016

Find Odd or Even in Python: 2rd Exercise of PracticePython



This is the2nd exercise practice Python for beginner


An easy way to find the number is odd or even


Exercise:


Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2?
Extras:
  1. If the number is a multiple of 4, print out a different message.
  2. Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message.
Solution:



GitHub reference:


Github code


https://gist.github.com/pinkpretty/ffd1cbceb82e1ebaf87761e07ef6644a


Happy coding ! :)



2 comments:

  1. Hi Nithya,
    Thanks for your post.Can i get any docs for the Python related.

    ReplyDelete
  2. Hi,
    You can learn here
    https://docs.python.org/3/tutorial/index.html

    ReplyDelete