Frontend Development

I want algorithm in python

Submitted by morgana72, , Thread ID: 231390

Thread Closed
morgana72
Member
Level:
11
Reputation:
0
Posts:
117
Likes:
12
Credits:
177
17-01-2022, 10:42 AM
#1
I want an algorithm in python
return even number on the function
please help me with that

RE: I want algorithm in python

Chartharki
Newbie
Level:
1
Reputation:
0
Posts:
16
Likes:
0
Credits:
18
17-01-2022, 01:19 PM
#2
# list of numbers
list1 = [10, 21, 4, 45, 66, 93]

# iterating each number in list
for num in list1:

# checking condition
if num % 2 == 0:
print(num, end=" ")


Input: list1 = [2, 7, 5, 64, 14]
Output: [2, 64, 14]

Input: list2 = [12, 14, 95, 3]
Output: [12, 14]

RE: I want algorithm in python

elin
Junior Member
Level:
9
Reputation:
0
Posts:
88
Likes:
8
Credits:
141
13-02-2022, 09:15 AM
#3
if you are a programmer you can use these website, git.ir, https://nulling.net/, w3schools.com

RE: I want algorithm in python

morgana72
Member
Level:
11
Reputation:
0
Posts:
117
Likes:
12
Credits:
177
OP
15-02-2022, 08:26 AM
#4
thanks a lot, this the best website

RE: I want algorithm in python

k1xas
Newbie
Level:
1
Reputation:
0
Posts:
14
Likes:
0
Credits:
15
20-02-2022, 01:25 PM
#5
def even(number):
return number%2==0 #returns True if the number is even

Users browsing this thread: 1 Guest(s)