Question: TEST: test_values = 0 1234 -1234 12.4.split() for number in test_values: print(number) break_into_parts(number) RESULT: 0 sign: + integer: 0 fraction: 0 1234 sign: + integer:
TEST:
test_values = "0 1234 -1234 12.4".split() for number in test_values: print(number) break_into_parts(number)
RESULT:
0 sign: + integer: 0 fraction: 0 1234 sign: + integer: 1234 fraction: 0 -1234 sign: - integer: 1234 fraction: 0 12.4 sign: + integer: 12 fraction: 4
The function has this signature: def break_into_parts (decimal_string) Break the decimal string into the sign, the integer part and the fractional part. The decimal string is guaranteed to be valid as in Program 3. The function must print the sign, integer and fraction part as below. If the sign is not negative it is printed as "+", if the fractional part does not exist it is printed as "O If the dedimal string is -12.40 the output would be: sign: -integer: 12 fraction: 40 If the string is 1234 the output would be: sign: + integer: 1234 fraction: 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
