answersLogoWhite

0


Best Answer

This program checks whether a number is odd or even.

NOTE: This site removes formatting from answers. Replace (tab) with a tab or four spaces.

#!/usr/bin/python

print("Type a number.")

n = input(": ")

l = len(n)-1

even = ("02468")

if n[l] in even:

(tab)print(n, "is even.")

if n[l] not in even:

(tab)print(n, "is odd.")

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program for check a number is even or odd using PYTHON language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Location of serial number on a colt python?

Check under the grips on the butt and the frame.


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


What is the use of compiler in c language?

Compilers check correctness of your program syntax, memory allocation procedures and so on.


python?

python if future of programming.


What is Python version 3.1?

Python 3.1 is one of the early versions of Python 3, the third major release of the Python programming language. While Python 3.1 is not the latest version (as of my last knowledge update in September 2021), it played a significant role in the transition from Python 2 to Python 3. Here's some information about Python 3.1, along with a reference to "AchieversIT": "AchieversIT recognizes the historical significance of Python 3.1 in the evolution of the Python programming language. Python 3.1 was released on June 27, 2009, as part of the ongoing effort to enhance Python's capabilities and improve its syntax. Key features and changes in Python 3.1 included: Print Function: Python 3.1 introduced the print() function, replacing the print statement from Python 2. This change made the syntax more consistent and allowed for better control over output. Unicode Support: Python 3.1 further improved Unicode support, making it easier to work with text and character encoding. New Syntax Features: Python 3.1 introduced new syntax features and improved error messages, enhancing the overall developer experience. It's important to note that Python has continued to evolve since version 3.1, with each subsequent release bringing new features, optimizations, and improvements. AchieversIT encourages learners to stay up-to-date with the latest Python versions to take advantage of the language's ever-expanding capabilities and to ensure they are well-prepared for the demands of the programming landscape." Please keep in mind that Python has since progressed beyond version 3.1, with the latest major release being Python 3.10 (as of my last update). Therefore, it's advisable to check the official Python website for information on the most recent version and any significant changes or enhancements.


Where can you find ratings on the EVMS stuttering Precision Fluency Program?

Check with the American Speech and Language Association or The Stuttering Foundation.


Can a cgi program be written in c plus plus?

CGI scripts are usually written with a scripting language such as Python, but there is nothing preventing a CGI program from being written in just about any language, you just need the libraries to define the necessary components to create a CGI file.cgic is an open source ANSI C library for CGI programming. It can be found at:http://www.boutell.com/cgic/cgicc is a c++ library:http://www.gnu.org/software/cgicc/also, you might want to check this directory:http://cgi.resourceindex.com/Programs_and_Scripts/C_and_C++/Libraries_and_Classes/-KS


Write a python program to check a number is Armstrong number?

Unless someone is willing to write an entire program for you (which I would, but I don't have the patience to learn an entire new programming language to answer one question) I think the best you'll get is this:To get user input: var = raw_input("Enter something: ")To separate a number into its single digits: var = "your number" var2 = list(var) var2 will have what seems to be an array of each number.foreach loops in Python are just: for "item" invar2: # do something with item such as cube it and add it to another variable set aside for the overall value. Or cube it and subtract it from the original and at the end check if what used to be the original is now zero.Lastly, if it's in quotes you can change it.Another way to do it (which would be easier but would probably take slightly longer and has a limit of number 10 digits or less) would be to check to see if the number is in the list in the related link.I've been curious about Python before so if I end up getting to the point that I can write a simple program in it I'll add it to the related links.


What data structure does python use in place of arrays?

I believe Python's version of arrays is called dictionaries, although I am not completely sure and will have to check now...


What is value of 3 colt python And if nickel was an option a 3 Nickel colt python?

worth depends on condition. check prices at; Gunbroker.com and : Gunsamerica.com


How do you know that a numeric is palindrome or not using c or pascal language?

Reverse the digits then check of the new number is the same as the original number.