Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
- #(If you donβt know what a divisor is, it is a number that divides evenly into another number.
- #For example, 13 is a divisor of 26 because 26 / 13 has no remainder.)
- num = input("Enter a number, i will find all the divisors \n")
- if num.isdigit():
- num = int(num)
- div = [i for i in range(1,num + 1 ) if num % i == 0]
- print(div)
- else:
- print("Wrong entry \n ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement