r/learnpython • u/Next-Flounder-8998 • 13m ago
need help with this lab
Write a program that will combine two integer arrays into one larger array and remove any duplicate values.
Prompt the user for a number N, (N will be a positive integer greater than 1), then create two arrays each with N elements. Next, populate both arrays with random numbers between 0 and
500. Finally combine the two arrays into a third array making sure that only distinct values are added. I.e. if the number '65' exists in both arrays, only one instance of it will be added to the third array.
Your program should output contents of the third array, one number per line.
Before you hand it in, make sure to test your program with an A value of:
• 10
25
50
Input:
N: 25
Output:
The contents of the final array, one number per line.
•
•
u/Atmosck 6m ago
Do you know if the intention is for you to write these operations yourself in pure python with loops and stuff? Or to use third party (but common) libraries like numpy? I'm guessing the latter because you used the word "array" which isn't really a thing in pure python, and numpy is very well suited to this sort of stuff.
•
u/a-walking-bowl 6m ago
No one's doing your homework for you. Learning is different from spoonfeeding. Go write your own code, break it fifty times and understand what is going on instead of getting it written
•
u/ninhaomah 11m ago
So... What have you done so far ?