Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started