Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##### User id and password setup #####
- correct_user_id = "your_username"
- correct_password = "your_password"
- attempts = 0
- max_attempts = 3
- while attempts < max_attempts:
- # Get user input
- user_id = input("Enter your user id: ")
- password = input("Enter your password: ")
- # Check user id and password
- if user_id == correct_user_id and password == correct_password:
- print("Login successful!")
- break
- else:
- attempts += 1
- print(f"Invalid user id or password. Attempts left: {max_attempts - attempts}")
- print("Too many incorrect attempts. Exiting.")
- ##### Initialize an empty list for the to-do items #####
- to_do_list = []
- while True:
- # Get user input
- task = input("Enter a to-do item (or 'End Session' to finish): ")
- # Check for end condition
- if task.lower() == "end session":
- break
- # Add the task to the to-do list
- to_do_list.append(task)
- # Print consolidated to-do list
- print("\nConsolidated To-Do List:")
- for index, item in enumerate(to_do_list, start=1):
- print(f"{index}. {item}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement