Python:
Given a list x = [2,3,5,6,7,8,9], write a python program that find those numbers which are divisible by 3. Arrange these numbers in a list called “result”.
# Given list x = [2, 3, 5, 6, 7, 8, 9] # Initializing result with empty list result = [] # looping through each value of list x for i in x: # Checking value of variable i is divisible by 3 if(i%3==0): # Appending i to list result result.append(i) # Printing content of result print(result)
Get Answers For Free
Most questions answered within 1 hours.