Frontend Development

I want algorithm in python

Submitted by morgana72, , Thread ID: 231390

Thread Closed

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]

Users browsing this thread: 1 Guest(s)