first hw batch 15.3.25 at 11:09

This commit is contained in:
Eduard Prigoana 2025-03-15 11:11:42 +02:00
commit 288c7e127a
10 changed files with 73 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,8 @@
# Ask the user for their age
age = int(input("Enter your age: "))
# Check if the user is 18 or older
if age >= 18:
print("You can vote")
else:
print("You cannot vote yet")

View file

@ -0,0 +1,10 @@
# Question: Ask the user to enter a password. If they enter “letmein”, display the message “access granted”.
# Ask the user to enter the password
password = input("Enter your password: ").strip()
# Check if the password is "letmein"
if password == "letmein":
print("Access granted")
else:
print("Access denied")

View file

@ -0,0 +1,12 @@
# Start of the program
num = int(input("Enter a number: "))
# Check if the number is greater than 100
if num > 100:
print("Thank you")
else:
num += 100
print("I have changed your number as it was too low")
# Output the final number
print("Your number is", num)

Binary file not shown.

View file

@ -0,0 +1,10 @@
# Question: Ask if the user likes pizza. If they answer “yes” display “I like pizza too”, otherwise display “My favourite food is pizza.”
# Ask the user if they like pizza
response = input("Do you like pizza? (yes/no): ").strip().lower()
# Check the response and display appropriate message
if response == "yes":
print("I like pizza too!")
else:
print("My favourite food is pizza.")

View file

@ -0,0 +1,10 @@
# Question: Change your password program you created earlier. If they enter “letmein”, display the message “access granted” otherwise display “access denied”.
# Ask the user to enter the password
password = input("Enter your password: ").strip()
# Check if the password is "letmein"
if password == "letmein":
print("Access granted")
else:
print("Access denied")

View file

View file

@ -0,0 +1,10 @@
# Question: Ask the user for their age. If they are 18 or older tell them “You can vote”.
# Ask the user for their age
age = int(input("Enter your age: "))
# Check if the user is 18 or older
if age >= 18:
print("You can vote")
else:
print("You cannot vote yet")

View file

@ -0,0 +1,13 @@
# Ask the user to input two numbers
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
# Calculate the average
answer = (num1 + num2) / 2
# Check if the average is less than 100
if answer < 100:
print("The average is", answer)
# Print "Goodbye" at the end
print("Goodbye")