What will be the output of the following Python code?
‘{a}{b}{a}’.format(a=’hello’, b=’world’)
a) ‘hello world’
b) ‘hello’ ‘world’ ‘hello’
c) ‘helloworldhello’
d) ‘hello’ ‘hello’ ‘world’
Answer: c
Explanation: The code shown above prints the values substituted for a, b, a, in the same order. This operation is performed using the format function. Hence the output of the code is: ‘helloworldhello’.
Related Posts
The ________ function can be used to create vectors of objects by concatenating things together.
What will be the output of the following R code?
> x <- vector(“numeric”, length = 10)
> xWhich of the following can be considered as object attribute?
R objects can have attributes, which are like ________ for the object.
Attributes of an object (if any) can be accessed using the ______ function.
Point out the correct statement?
If you explicitly want an integer, you need to specify the _____ suffix.
Join The Discussion