Odd and Even using Append in python


Odd and Even using Append in Python

If you divide a number by 2 and it gives a 
remainder of 0 then it is known as even number,
 otherwise an odd number.

Algorithm :

step1:start
step2:def variable(abc):
step3:take empty set of odd and even
step4:use loop in number you given
step5:check the condition if its true 
      then append in even else odd 
step6:return output
step7:enter number 
step8:print(def_variableName(pass_number))
step9:end
 
Example

def odd_even(num):


odd=[]

even=[]

for i in num:

if i%2 == 0:

even.append(i)

else:

odd.append(i)

output_num=[odd,even]

return output_num

number=[1,2,3,12,15,6,7,8,9]

print(odd_even(number))

 

Odd and Even using Append in python – My Programming School

Have any Question or Comment?

2 comments on “Odd and Even using Append in python

Leave a Reply

Your email address will not be published. Required fields are marked *

Domain & free Hosting

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.