id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

incrementTillEqual


Write a function incrementTillEqual(a,b) which takes two integer parameters, determines which is larger, and uses a while loop to increment the smaller until they are equal. Use a counter which starts at 0 to keep track of how many times the while loop runs and return the counter at the end.


incrementTillEqual(1, 2) → 1
incrementTillEqual(6, -42) → 48
incrementTillEqual(1012, 55) → 957

...Save, Compile, Run (ctrl-enter)

def incrementTillEqual(a,b):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy