Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use if with and function?
#3
i wrote like this;
num = int(input("Please enter a number: "))
 
if num %2 == 0:    #If the value entered is a number and divided by two,
    print(f"{num} is an even number")            #say it as an even number
 
else:
    print(f"{num} is an odd number")
but if some one make a mistake and enter a string , i want to warm
Reply


Messages In This Thread
Use if with and function? - by ibutun - May-30-2020, 05:42 PM
RE: Use if with and function? - by ndc85430 - May-30-2020, 05:48 PM
RE: Use if with and function? - by ibutun - May-30-2020, 05:55 PM
RE: Use if with and function? - by menator01 - May-30-2020, 05:56 PM
RE: Use if with and function? - by ibutun - May-30-2020, 06:35 PM
RE: Use if with and function? - by pyzyx3qwerty - May-30-2020, 05:57 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020