Question 1: square root format
description
Obtaining an integer a, calculates the square root of a user input, 3 digits after the decimal point, and prints.
30 using the output character width, the output right-justified, the extra character is a plus sign (+) is filled.
If the result is more than 30 characters, it is subject to the result width.
Example O
Entry | Export | |
Example 1 | |
|
answer:
a = eval(input()) print("{0:+>30.3f}".format(pow(a,1/2)))
Question 2: string segment composition
description
Obtaining input a string s, character minus sign (-) split s, compositions in which the two end to end by a plus sign (+) output.
Example O
Entry | Export | |
Example 1 | |
|
answer:
s=input() l=s.split('-') print(l[0]+'+'+l[-1])