Q. What expression would you form so that from the given values, the desired result is obtained?
You can use any string manipulation operators, methods along with str () and int () functions.
Values | Desired result | Expression | |
---|---|---|---|
(a) | a = "30" b = 20 c = 50 d = "12" |
20501230 | a = "30" b = 20 c = 50 d = "12" print (int(str(b) + str(c) + d + a)) |
(b) | b = 40 a = str(40) c = 20 d = "12" |
"40201240" | b = 40 a = str(40) c = 20 d = "12" print (str(b) + str (c) + d + a) |
(c) | a = "hello" b = 1 d = "2" c = 20 |
"1202 hello" | a = "hello" b = 1 d = "2" c = 20 print (str(b) + str (c) + d +" " + a) |
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )