Good Evening,
I'm stuck in a headache and am looking to get some solutions. I've been given a problem that wants me to input 9 integers, and list the occurrences of those 9 integers. I've done it one way but the tool our class uses called 'Livelab' doesn't accept the code I gave it. For this purpose I will show both source code.
For the rejected code I used:
The code I'm working on currently looks like this. I've got some of the print statements to work within Idle, but am having trouble and the book I have has been little help.
Any help would be appreciated!
I'm stuck in a headache and am looking to get some solutions. I've been given a problem that wants me to input 9 integers, and list the occurrences of those 9 integers. I've done it one way but the tool our class uses called 'Livelab' doesn't accept the code I gave it. For this purpose I will show both source code.
For the rejected code I used:
1 2 3 |
from collections import Counter a = [ 2 , 5 , 6 , 5 , 4 , 3 , 23 , 43 , 2 ] print (Counter(a)) |
1 2 3 4 5 6 7 8 9 |
for i in range ( 9 ): num_list = int ( input ( "Enter integers between 1 and 100: " )) print (num_list.count( 2 )) print (num_list.count( 5 )) print (num_list.count( 6 )) print (num_list.count( 4 )) print (num_list.count( 3 )) print (num_list.count( 23 )) print (num_list.count( 43 )) |