Help I am failing the 4th. How do I fix.
123456T 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 def plusOne (digits): i = len (digits) - 1; out = [] temp = digits + 1 while (True): if (temp == 10): else: out.insert(0, 0); carry = 1; out.insert(0, temp); carry = 0 i=i-1; if (i < 0): break; temp = digits + carry; return out;
Calling with Arguments Name Arguments Actual pass plusOne [1, 2, 3] [1, 2, 4] [1, 2, 4] pass plusOne [1, 4, 9] [1, 5, 0] [1, 5, 0] pass plusOne [0] [1] [1] fail plusOne [9, 9, 9, 9] [0, 0, 0, 0] [1, 0, 0, 0, 0] Expected
Help I am failing the 4th. How do I fix.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am