3 Python Projects Code
3 Python Projects Code
import time
def countdown_timer(seconds):
while seconds > 0:
print(f"Time remaining: {seconds} seconds")
time.sleep(1) # Delay for 1 second
seconds -= 1
print("Time's up!")
def main():
try:
seconds = int(input("Enter the countdown time in seconds: "))
countdown_timer(seconds)
except ValueError:
print("Invalid input. Please enter a valid number of seconds.")
if __name__ == "__main__":
main()
//////////////////////////////////////////////////
# Draw a heart
heart()
# Write text
txt()
# To hide turtle
pen.ht()
/////////////////////////////////////////////////////////
import random
import array
SYMBOLS = ['@', '#', '$', '%', '=', ':', '?', '.', '/', '|', '~', '>',
'*', '(', ')', '<']
# randomly select at least one character from each character set above
rand_digit = random.choice(DIGITS)
rand_upper = random.choice(UPCASE_CHARACTERS)
rand_lower = random.choice(LOCASE_CHARACTERS)
rand_symbol = random.choice(SYMBOLS)
# now that we are sure we have at least one character from each
# set of characters, we fill the rest of
# the password length by selecting randomly from the combined
# list of character above.
for x in range(MAX_LEN - 4):
temp_pass = temp_pass + random.choice(COMBINED_LIST)