how to get input from user in pyqt5

name, result = QtWidgets.QInputDialog.getText(MainWindow, "Name of the Team",
                                                          "Enter the name of your team:")
# Put this code inside a function and connect it to any signal.

Here is what the above code is Doing:
1. It creates a QInputDialog instance.
2. It sets the window title to “Name of the Team”.
3. It sets the label text to “Enter the name of your team:”.
4. It displays the dialog as a modal dialog, and waits for the user to click the OK or Cancel buttons.
5. It stores the text that the user entered in the dialog in the variable text.
6. It stores the result of the dialog in the variable result.