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

 

gaurav1780@gmail.com 06_strings > add_strings
prev  |  next  |  chance

Define a function that when passed two Strings, each holding a (possibly very very long integer) as a String, returns the sum of the two numbers, as a String. You may assume that both numbers are positive (more than zero). NOTE: The strings can be very very very very long so don't even try to convert them to integers.


add_strings('49631058602853065830185206186591385964821306890681', '934593852935839589589458395835234589248295893578295673962769763976967395475') → '934593852935839589589458445466293192101361723763501860554155728798274286156'
add_strings('1', '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999') → '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
add_strings('99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999', '1') → '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'

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

def add_strings(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

Difficulty: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy