S.Y.I.T Sem 3 Python Practical | Python| Python practical 1b| Odd or even number| python for beginner
Hello reader's ,
This blog is for those students who are studying in second year of information technology. This blog is the practical of python subject which is in sem 3. In this blog you are going to see that how you can ask user to enter a number and depending on whether the number is even or odd print out an appropriate message to the user.
An integer's parity is even if it is divisible by two with no remainders left
and its parity is odd if it isn't; that is, its remainder is 1.
For performing this practical you must have install python on your laptop or pc. to download python - https://www.python.org/downloads/
python website |
go to the link and download python and you need a IDE which supports python, i am using VS Code, you can use python IDE too.
vs code |
pycharm logo |
After the successful installation open ide and type the code or simply copy the code from given below and run it to see the output.
CODE -
number = int(input("Enter the number: "))
mod = number % 2
if mod >0:
print("This is an odd number. ")
else:
print("This is an even number. ")
Thanks for sharing a useful information..
ReplyDeletePython Online Training In Hyderabad
Python Online Training