Question: is there a way to group up the count command for python, im new and want to shorten this code for num in counts: if

is there a way to group up the count command for python, im new and want to shorten this code

for num in counts: if num == 1: counts[1] = counts[1] + 1 if num == 2: counts[2] = counts[2] + 1 if num == 3: counts[3] = counts[3] + 1 if num == 4:

want to make it so it can be in 1 line of code and not 20 because i have to go until 21

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!