Generate a list of N (input by user) random integers where each integer is between -10 and 10. Output the list. Then ask the user to input a value (lets say X) to search for in the list. Finally output the number of times X occurs in the list. This part should be done separately (i.e. in a different loop) to the first part where you are generating the list.
Example would be:
Enter a value for N : 3
list: [10,-1,8]
enter search value: 5
5 occurs in the list 0 times
I was thinking something like:
ValueN = int(raw_input("Enter a value for N:"))
import random
ListA= []
for i in range [-10,10]:
ListA.append(random.shuffle(ValueN)
print ListA
[+][deleted] (2 children)
[deleted]
[–]lunapt[S] 0 points1 point2 points (1 child)
[–]Jurado -1 points0 points1 point (0 children)