- 1
Write a programme that takes a sequence of ints and determines if the numbers a different.
3 ответов
0
Your program works for ex: 12345 but not for 1 2 3 4 5
Ebrahim Hassan how you are entering input?
If you are giving with a space separating then you need to split input input list..
+ 1
Ok this is my attempt.
def nums_different(nums):
nums1 = [ ]
for x in nums:
if x not in nums1:
nums1.append (x)
if len (nums1) == len (nums):
print ("numbers are different. ")
else:
print ("numbers not different.")
numbers = list (input ("enter a series of numbers "))
nums_different(numbers)
+ 1
Ebrahim Hassan if len(nums1) != len(nums)