Python Example Program to Check if a Number is Even or Odd ( User Input )
ฝัง
- เผยแพร่เมื่อ 21 เม.ย. 2019
- In this tutorial you will learn to write a Python Program to Check if a Number is Even or Odd.
First we ask the user to enter a number and we store that in a variable.
Then we divide that number by 2 and we check for the remainder value.
if the remainder is 0 then it means that the number is even, else the number is odd,
Finally we display the result on the screen.
our Social Media Pages
/ exampleprogram
/ exampleprogram
/ examplecomputerprogram
Our Website
www.ExampleProgram.com
#PythonProgramming #ExampleProgram
in the end how you mentioned dislike the video if you didnt like it, this video was exactly what it had to be straight to the point and clearly explained for everyone even people who have never seen code before
you got a new subscriber
Thank you
Keep learning 🙏
wonderful explanation.......this video has cleared all my doubts on this even and odd number program......I am literally thanking you more than a hundred times for this wonderful help......Thank you :D
You're most welcome
So easy n understandable video for even or odd program 😊😇
all other videos were just gonna show you the code without any explanation and thats it, although, you did an amazing explanation, love from Saudi Arabia ❤️
well detailed explanation....thank you...and make many more video for class 11 and 12th!!
I will try my best
@@ExampleProgram plz tell with forcloop
Your explanation was very to the point and simple, I loved it. I am subscribing to your Chanel.
Awesome, thank you!
print("number is odd") if int(input("number: "))%2 else print("number is even")
hippity hoppity your code is my property
Not quite because you can also divide a odd number
@@chugh97 ?
Can we write this??
@@legengmer5567no you can eat this
been trying to do this for hours and watched ur video n did it in 1 min...tysmmmmm
You're welcome!!
This is well explained!!
Thank u!!
You're welcome!
Thank u so much sir!!! Your explanation is so good.
Pleasure :)
thank you so much, you're a life saver!
You're welcome!
Thank you!
You're welcome!
Your explanation is very useful and interesting thankyou
You are welcome
I am speechless
Mind blowing explanation Sir👌
Thank you so much 😀
Thanku sir today was my computer practical exam and i scores full in it i am subscribing ur channel
Great 👍
num1 = int(input("Enter your number to check: "))
if num1 % 2 == 0:
print(f'{num1}' ' is even')
else:
print(f'{num1}' ' is odd')
:)
@@ExampleProgram what if the number is 10 or 12, they don’t divide to equal 0
@@getreadyforthatspaghettiad168 they get divided by 2.....and the result would be 0....so
@@jananjaymedhi1251 😀
@@jananjaymedhi1251 the result is not 0 the remainder is 0
Really great video explaining it very nicely!
Thank you!
thanks for this video , It wsa helpful .
I solved my homework by your video
Most welcome 😊
Thanks you sir
my program is this: nums = input("Enter 2 numbers, or press 'q' to quit:")
remainder = nums % 2
while(nums != "q"):
if (remainder == 0):
print(nums, "is an even number")
else:
print(nums, "is the bigger number")
Never thought about that
Thank you so much!
I am also trying to teach Python in my channel
All the best
Thank you sir 😎😍😍
Most welcome :)
Thanks 😊
Welcome 😊
Sir ur videos r so helpful to me☺☺
glad my tutorials are helping you
keep learning :)
thanks it help me a lot
Glad it helped
Thank u so much sir
my pleasure :)
Thank you so much sir❤
Most welcome
Thanks bruhh
Pleasure
Thank you
You're welcome
Thankyou so much for this🙂🌼
My pleasure 😊
nice info keep continue.sir
Thank you, I will :)
Thanks brother ❤️❤️
You're welcome 😊
Thank you❤
You're welcome 😊
Such a wonderful video and such a good explanation thanks!
You're very welcome!
Great
thank you :)
Very nice sir
Thanks
thank u
Welcome
It worked....!😄
Great!
Very nice
thank you :)
tq sir it helps me
Pleasure
😊thanks
Welcome 😊
Very nice video
Tq so much
Welcome 😊
i did it 😯🥳
cool :)
👌
thanks
Ty😭
thanks a lot sir. very very simple and good wording you used and I subscribed you
Pleasure :)
Thank u sir
Welcome
hey, i have a doubt that isnt related but, what if i wanna add 2 numbers with input and then if someone inputs a word then type a message saying "please enter a number" ?
the way you break down the code is incredible I've never felt more confident coding up till now
Awesome! Thank you!
What If We Want The Username To Enter Two different numbers and we have to find which one is even and which one is odd.
Please Tell How Can We Do That What's The Python Program For That 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
If the input is only in one line then what I will do is
x = int(input())
x = x.split() #Leave blank if you want to remove spaces to make a list
Then you can make your code
Hi! What if the user wanted to know the even numbers between a range of negative to positive integers? Is it possible or it can only print positive integer/s?
Sir there invalid syntax is coming
Same...here..
u are respected 6:21
Are u teacher or professional programmer???
X=int(input("Enter the number here"))
if (x % 2 == 0):
Print(X,"is an even number")
Else:
Print(X,"is an odd number")
looks good :)
Very nice explaination... Just the pronunciation of remainder is not rim-i-nder, its rim-ain-der :) Just saying... :D
ok
a=int(input("enter the number"))
If(a%2===0):
Print("the number is even")
Else:
Print ("the number is odd")
Sir, is this correct? Please reply
hi i did not understand why you have used % instead of /
/ is division operator
% is modulus operator
% is used to get the remainder value when we divide a number by another number
when I'm typing print(number, " is an even number ") its coming error expected an indented block after 'if' statement on line 1
Sir pls say how to change the font size
go to settings
number = int (input ("Enter the number:"))
if number % 2 == 0:
print (" Number is Even:")
else:
print ("Number is Odd:")
yup :)
thanks
hello ...!
can u expailn this program sir ...!
string Rotation Q
input is : python and onpython
expected output is : 2
pls if any body can u write a program plz .....!
Sir who to prees modular division symbol % in codetantra in mobile key board
sir how to find special number vidieo
How do I make it so that when I enter something that is not a whole number it says "Invalid"
The most beautiful English accent doesn't exis-
agr mai float (22.2) input kr raha hu toh ye o/p odd de raha h.. why?
Please write a program to check whether the given number is even or odd *_using class_* in python
Mehak loveyou❤
Achaaa❤
Dekh lia
Never Mind
Achaaa
Noice
What if we enter 0? It is displaying it as even! What to do?
10 is even or odd number sir....?
def oddeven(a):
if (a%2==0):
return 1
else:
return 0
num = int(input("Enter a number: "))
if (oddeven(num)==1):
print("The given number is Even")
else:
print("The given number is Odd")
this one is with function :)
wow this one is different from other
@@devanandanbs8714 yup I used function so it made the program difficult
how about zero? this number is not even or odd !!! how can I solve this problem?
Har Har Mahadev ❤️❤️❤️❤️
Display numbers from 1 to 50. Numbers divisible by 3 should be
displayed as “Accord”, divisible by 5 should be displayed as “matrix”.
Numbers divisible by 3 and 5 should be displayed as “Accord info"Matrix" how to create the code in python
what is the editor name
visual studio code
My code is not working
number=int(input("Enter A Integer Number"))
remainder=number % 2
if (remainder==0):
print(number," is an even number")
else:
print(number," is an odd number")
Did u tried it on idle?
if (remainder==0):
The code isn't working because of the parentheses. Don't forget to add spaces between a value and the operator like:
if remainder == 0:
or
remainder = number % 2
Whenever I press Enter it asks for the input right away
post you code
@@ExampleProgram dw, i fixed it the problem was that I was not opening python in edit mode
@@ExampleProgram Thanks to ur video i did my exam perfectly :)
welcome :)
I am litteraly in 8th and I have to learn this shit
You are literally in 8th, but still don't know how to spell "Literally"
how to check if a num is positive even and positive odd, negative even and negative odd ( user input ).can u please code me this out? just write in the comment, i will get that.
🌑
whats that ??
Tareeka to yrr yahi hai but invalid syntax aarha hai !!
hhhhhhhhhhhheiiiiii suuuuuuuuuppppppppppppppppppppppppperrrrr yyyyyaa
Thanks :)
you can always count on indian guys on youtube
Ha ha :)
if 18 get its wrong
Sir maine ye program run karya. Toh error kyu aaraha h
Kya error aa raha hai
@@ExampleProgram syntax error
Check your code
My guy can't differentiate between reminder and remainder.
Any body single?
Uthke baitho
Thank you
You're welcome
Har Har Mahadev ❤️❤️❤️❤️