Question 1:
Output:
Explaination:
1. The program starts by importing the necessary modules from PyQt5 for creating the GUI.
2. The generate_username function takes the full name as input and splits it into separate first
name and surname components.
3. If the surname has four or more characters, the username is created by taking the first four
characters of the surname and appending the first character of the first name.
4. If the surname has fewer than four characters, the username is created by combining the entire
surname with as many characters as needed from the first name to reach a total length of five
characters.
5. If the resulting username is less than five characters, it appends the required number of zeros
to reach a length of five characters.
6. The generate_password function takes the full name as input, removes any spaces, and
randomly selects five characters from the remaining characters to create the password.
7. The main part of the code creates a Qt application and prompts the user to enter their full
name using a QInputDialog.
8. The entered full name is used to generate the username and password by calling the respective
functions.
9. The generated username and password are displayed in a QMessageBox as an information
message.
10. When the program is run, it displays a dialog for the user to enter their full name. After
entering the name and clicking OK, a message box appears showing the generated username
and password.
Output:
Explaination:
1. The program starts by importing the necessary modules from PyQt5 for creating the GUI.
2. The generate_username function takes the full name as input and splits it into separate first
name and surname components.
3. If the surname has four or more characters, the username is created by taking the first four
characters of the surname and appending the first character of the first name.
4. If the surname has fewer than four characters, the username is created by combining the entire
surname with as many characters as needed from the first name to reach a total length of five
characters.
5. If the resulting username is less than five characters, it appends the required number of zeros
to reach a length of five characters.
6. The generate_password function takes the full name as input, removes any spaces, and
randomly selects five characters from the remaining characters to create the password.
7. The main part of the code creates a Qt application and prompts the user to enter their full
name using a QInputDialog.
8. The entered full name is used to generate the username and password by calling the respective
functions.
9. The generated username and password are displayed in a QMessageBox as an information
message.
10. When the program is run, it displays a dialog for the user to enter their full name. After
entering the name and clicking OK, a message box appears showing the generated username
and password.