How can I create a list from the sum of two previous ones without some value appearing repeated, without using the set
function?
Example:
>>>a = [1, 2, 3]
>>>b = [3, 4, 5]
>>>c = a + b
>>>print c
[1, 2, 3, 3, 4, 5]
Note: I can not use the set function to create a set because I have not yet seen that term in ICC classes. I am in loop exercises ( while
), but in the way I wrote the program (wrong, almost certain) I did not use any loops.
If you can help me using ties, it would be interesting
How am I doing without the while:
a = int(raw_input())
x = range(0, a, 3)
y = range(0, a, 5)
lista = x + y
soma = sum(lista)
print soma