return object in python

Solutions on MaxInterview for return object in python by the best coders in the world

showing results for - "return object in python"
Luisa
11 Jun 2017
1# This function returns a dictionary
2def foo():
3     d = dict();
4     d['str'] = "Tutorialspoint"
5     d['x']   = 50
6     return d
7print foo()
8
9#Output
10#'x': 50, 'str': 'Tutorialspoint'}