Write a programme that takes a sequence of ints and determines if the numbers a different. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Write a programme that takes a sequence of ints and determines if the numbers a different.

15th Oct 2020, 12:15 PM
They Call Me Ebbs
They Call Me Ebbs - avatar
3 Answers
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..
15th Oct 2020, 1:34 PM
Jayakrishna 🇮🇳
+ 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)
15th Oct 2020, 12:19 PM
They Call Me Ebbs
They Call Me Ebbs - avatar
+ 1
Ebrahim Hassan if len(nums1) != len(nums)
15th Oct 2020, 12:39 PM
Abhay
Abhay - avatar