Monday, March 4, 2019

Odd and Even Numbers using Two Dimensional List in Python

Write a program that will ask the user how many values to be processed. The program also will ask the user to give integer values using two-dimensional list and check which of the given number is odd or even numbers being provided by the user and display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing



# odd_even.py
# Rollyn M. Moises and Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tOdd and Even Numbers using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of EVEN Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 == 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\t List of ODD Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 != 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")

No comments:

Post a Comment