What will be the output of the following Python code?
‘{0:f}, {1:2f}, {2:05.2f}’.format(1.23456, 1.23456, 1.23456)
a) Error
b) ‘1.234560, 1.22345, 1.23’
c) No output
d) ‘1.234560, 1.234560, 01.23’
Answer: d
Explanation: In the code shown above, various formatting options are displayed using the format option. Hence the output of this code is: ‘1.234560, 1.234560, 01.23’
Related Posts
What is the time complexity to count the number of elements in the linked list?
What is the time complexity of inserting at the end in dynamic arrays?
Which of the following is not a disadvantage to the usage of array?
What is the space complexity of a linear queue having n elements?
Given an array of size n, let’s assume an element is ‘touched’ if and only if some operation is performed on it(for example, for performing a pop operation the top element is ‘touched’). Now you need to perform Dequeue operation. Each element in the array is touched atleast?
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf(“%d “, head->data);
}
Join The Discussion