This is my code I want the user to enter a number they beleive the loop will run for until the running sum of integers is 21.
g = input('guess how many times');
n = randi ([1, 11]);
max_21 = 21;
sum = sum + a;
else sum = sum + a;
What I want it to do is loop throgh the random integers and create a running sum. When the sum exceeds 21 I want it to stop. I need to calculate how many times it loops. Then I want to compare the ammount of loops to the inputed guess. Thinking about it now I may need a while loop. Could someone help me out im stuck.