Explain the role of repr function.
Answer / chaitanya
Python can convert any value to a string by making use of two functions repr() or str().
The str() function returns representations of values which are human-readable, while repr() generates representations which can be read by the interpreter.
repr() returns a machine-readable representation of values, suitable for an exec command.
Following code sniipets shows working of repr() & str() :
| Is This Answer Correct ? | 0 Yes | 0 No |
How are uuid generated?
What does quit () do in python?
Do you know what is the key difference between a list and the tuple?
Under what circumstances would von use a while statement rather than for?
Narrate the difference between python arrays and lists.
Write a program in python to check if a sequence is a palindrome.
Which is better c++ or java or python?
What is a cast in python?
Why do we use uuid?
Is there a switch or case statement in python?
How do I create a variable number of variables?
What is gil in python?