Python Prg
Python Prg
import random
def guess(low,hogh):
print(f"\nYou have 7 chances to guess the number between {low} and {high}. Let's start!")
gc = 0 # Guess counter
gc += 1
if guess == num:
break
print("Hi! Welcome to the Number Guessing Game.\nYou have 7 chances to guess the number. Let's
start!")
guess(low,high)
output
You have 7 chances to guess the number between 5 and 15. Let's start!
"Yes, definitely.",
"Very doubtful."
]
while True:
question = input("Ask the magical 8 Ball a question (type 'exit' to quit): ")
if question.lower() == 'exit':
print("Goodbye!")
break
else:
output
Ask the magical 8 Ball a question (type 'exit' to quit): will i mood will change 2mrw
Ask the magical 8 Ball a question (type 'exit' to quit): when will i come out of this pain
Goodbye!
#Password Locker
password_locker = {}
def view_accounts():
if not password_locker:
return
print("\nSaved Accounts:")
def get_password(account):
if account in password_locker:
creds = password_locker[account]
print(f"\nAccount: {account}")
print(f"Username: {creds['username']}")
print(f"Password: {creds['password']}")
else:
while True:
if choice == '1':
view_accounts()
get_password(account)
break
else:
4. Exit
Account: 555
Username: hhh
Password: yyy
4. Exit
lines = text.strip().split('\n')
return '\n'.join(bulleted_lines)
wiki_text = """
"""
print(result)
output
quiz_data = {
questions = list(quiz_data.keys())
correct = quiz_data[question]
options = list(quiz_data.values())
options.remove(correct)
random.shuffle(choices)
quiz_file.write(f"{q_num}. {question}\n")
quiz_file.write("\n")
correct_letter = 'ABCD'[choices.index(correct)]
answer_file.write(f"{q_num}. {correct_letter}\n")
output
Quiz.txt
1. 2 + 2 = ?
A. 4
B. Cheetah
C. New Delhi
D. Pacific Ocean
2. Largest ocean?
A. New Delhi
B. 4
C. Pacific Ocean
D. Yellow
A. Yellow
B. Pacific Ocean
C. 4
D. Cheetah
4. Capital of India?
A. Cheetah
B. Yellow
C. New Delhi
D. 4
A. Cheetah
B. 4
C. New Delhi
D. Yellow
Answer.txt
1. A
2. C
3. D
4. C
5. D
#Multiclipboard
pip install pyperclip (type this at anaconda command prompt)
import pyperclip
clipboard_data = {
"email": "[email protected]",
"phone": "+91-9876543210",
print("Available keywords:")
print(f" - {key}")
if keyword in clipboard_data:
pyperclip.copy(clipboard_data[keyword])
else:
output
Available keywords:
- phone
- address
- greet