Brad
0
Q:

how to return an output to a function in Python

# A Python program to return multiple   
# values from a method using dictionary  
    
# This function returns a dictionary  
def fun():  
    d = dict();   
    d['str'] = "GeeksforGeeks"
    d['x']   = 20
    return d  
    
# Driver code to test above method  
d = fun()   
print(d)  
12
''' if you don't know def can make a function, 
I am making a simple squaring function to explain''' 
# space after parentisis is needed
def square(x) :
  s = x*x
  # do it with the return keyword!
  return s
1
def showPrompt(symbol :str, container :str) -> None:
    while container.lower() != "exit":
        container = str(input(symbol))
1

New to Communities?

Join the community