This Python project demonstrates the use of various fundamental programming concepts such as variables, conditional statements (if-else), loops (while), break statements, methods, and functions to create a simple username and password validation system. The project simulates a basic login system with multiple validation checks.
Project Overview
The project includes the following components:
- A list of valid email domains to check if the entered username is valid.
- A function
requestUsernameto allow the user to input their username up to 5 times, locking the account after unsuccessful attempts. - A function
requestPasswordto allow the user to input their password up to 5 times, locking the account after unsuccessful attempts. - The main code to initiate the program and prompt the user for their username and password.
Valid Email Domains
The project begins by defining a list of 100 valid email domains. You can add more domains to the list as needed.
valid_domains = ( # List of valid email domains (add more if needed) "gmail.com", "yahoo.com", "hotmail.com", # ... )
Usage
To run the program, execute the Python script. It will display a welcome message and prompt you to enter your username and password.
- If the username is not valid (doesn't end with a valid domain), the program will allow you to re-enter the username up to 5 times.
- If the password is not valid (less than 8 characters or more than 16 characters), the program will allow you to re-enter the password up to 5 times.
- If both the username and password are valid, you will receive a "Welcome to SBI" message.
Account Locking
If the user exceeds the maximum number of attempts (5) for either the username or password, the account will be locked, and a message to contact the administrator for unlocking will be displayed.
Contributing
Contributions to this project are welcome. If you have any improvements or feature suggestions, please feel free to submit a pull request.
Thank you for using the Username-Password Project using Python. Enjoy exploring and learning from this basic Python project!
This simple Python program allows you to encrypt and decrypt messages using a basic substitution cipher. It can be used for educational purposes to understand how text encryption and decryption work.
Features
-
Encryption: The
codefunction takes a message as input and encrypts it using a simple substitution cipher. Single characters are kept as they are, the positions of characters in two-character words are swapped, and longer words are encrypted with random characters at the start and end. -
Decryption: The
decodefunction reverses the encryption process, allowing you to recover the original message from the encrypted text.
General Knowledge Quiz Game
This is a simple Python quiz game that tests your knowledge of general facts and trivia. Players answer questions to win virtual money and see how much they can take home. The game includes questions from various categories, and it's a fun way to challenge your general knowledge.
Questions
The game includes a set of questions with multiple-choice answers. Each question is formatted as follows:
- Question: A general knowledge question.
- Answer Choices: Four answer choices (labeled 1, 2, 3, and 4).
- Correct Answer: The correct answer is indicated by the number (1, 2, 3, or 4).
How to Play
- Run the Python script.
- The game will start, displaying a question and answer choices.
- Enter your answer by typing the number (1, 2, 3, or 4) corresponding to your choice.
- If your answer is correct, you'll earn virtual money.
- The game offers different levels, and your winnings increase as you progress.
- You can choose to quit the game at any time by entering 0.
Example
Here's an example of a question:
- Question: What is the largest planet in our solar system?
- Answer Choices:
- Venus
- Mars
- Jupiter
- Saturn
- To answer, type the number corresponding to your choice (e.g., 3 for Jupiter).
Levels and Winnings
The game has different levels with increasing prize money. The more questions you answer correctly, the more money you can win. If you reach a certain level, your winnings will be locked in, and you'll take that amount home even if you answer a question incorrectly.
Quitting the Game
You can choose to quit the game at any time by entering 0. Your earnings at that point will be your final prize.
Enjoy testing your general knowledge with this quiz game!