Home > other >  Looking for digital Python
Looking for digital Python

Time:09-18


?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Input a series of Numbers separated by Spaces, which requires only one number appear odd times, the even number in other times, find and output the occurrences for odd number,
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Input format
Enter the Numbers in the blank space interval, wrap the end
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Example:
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 1 1 2 2, 3, 4, 4, 10 10
The output format
3

CodePudding user response:

 import more_itertools as mi 
R=list (map (int, input (" & gt;" ). The split (" ")))
R.s ort ()
L=mi. Run_length. Encode (r)
Result=[v1 for v1, v2 l if v2 in % 2==1)
Print (result [0])

CodePudding user response:

Input_number=input (" a series of Numbers separated by Spaces, of which only one number appear odd times, the even number in other times: ")
Num_list=input_number. The split ()
Unique_num_list=list (set (num_list))
For num in unique_num_list:
If num_list. Count (num) % 2==1:
print(num)

CodePudding user response:

R=0
For I in input (). The split (' ') :
R=r ^ int (I)
Print (r)
  • Related