0

I'm trying to turn my Caesar Cypher code into an exe file, and I did. But the problem I'm having is that it immediately closes once it finishes, so I can't even see the encrypted text. I've thought of adding an input like "press 1 to repeat" so I'm turning the whole asking for user input thing into its own function that can be looped, but it has to return the encrypted message and its key.

Is there a way of returning one string value and a list, inside one function?

Chris Martin
  • 30,334
  • 10
  • 78
  • 137

1 Answers1

2

Yes, Python supports multiple return values for functions by separating the return values with commas. e.g.,

def foo():

    return 1, 2, 3

a, b, c = foo()

Where printing a, b, and c respectively gives the following:

>>> print(a)
1
>>> print(b)
2
>>> print(c)
3
Erick Shepherd
  • 1,403
  • 10
  • 19