Open utterances-bot opened 1 year ago
age = 17 if age <= 18: print("you can't vote ") else: print("you can vote")
salary = float(input("Enter your salary: ")) years_of_service = int(input("Enter your years of service: "))
if years_of_service > 5: bonus_percentage = 5 # 5% bonus bonus_amount = (bonus_percentage / 100) * salary print(f"Congratulations! You are eligible for a {bonus_percentage}% bonus.") print(f"Your bonus amount is: ${bonus_amount:.2f}") else: print("Sorry, you are not eligible for a bonus.")
marks = float(input("Enter your marks: "))
if marks < 25: grade = "F" elif marks >= 25 and marks < 45: grade = "E" elif marks >= 45 and marks < 50: grade = "D" elif marks >= 50 and marks < 60: grade = "C" elif marks >= 60 and marks <= 80: grade = "B" else: grade = "A"
print(f"Your grade is: {grade}")
def votecheck(age): if age >= 18:
print("You are eligible to vote.")
else:
# If you are younger than 18, then you are not eligible to vote.
print("You are not eligible to vote.")
age = input("Please enter your age: ") age = int(age) votecheck(age)
def bonuscheck(salary, years): if years > 5:
bonus = salary * 0.05
print("Net Bonus:", bonus, "dollars")
else:
# If the person has been at the company for less than 5 years, there is no bonus.
print("Net Bonus: 0 dollars")
years = input("How many years have you been in the company: ") years = float(years) salary = input("What is your annual salary: ") salary = float(salary) bonuscheck(salary, years)
def gradecheck(score):
if score < 25:
print("F")
elif score >= 25 and score < 45:
print("E")
elif score >= 45 and score < 50:
print("D")
elif score >= 50 and score < 60:
print("C")
elif score >= 60 and score < 80:
print("B")
elif score >= 80:
print("A")
score = input("Please enter your score: ") score = float(score) gradecheck(score)
citizen = input("Are you a citizen? (yes/no): ").lower() age = int(input("Enter your age: ")) if citizen == "yes" and age >= 18: print("You are eligible to vote.") else: print("You are not eligible to vote.")
salary = float(input("Enter your salary: $")) years_of_service = int(input("Enter your years of service: ")) if years_of_service > 5: bonus = 0.05 * salary print(f"You are eligible for a bonus of ${bonus:.2f}.") else: print("You are not eligible for a bonus.") net_bonus = 0 if years_of_service <= 5 else bonus print(f"Net Bonus Amount: ${net_bonus:.2f}")
marks = float(input("Enter your marks: ")) if marks < 25: grade = "F" elif 25 <= marks < 45: grade = "E" elif 45 <= marks < 50: grade = "D" elif 50 <= marks < 60: grade = "C" elif 60 <= marks < 80: grade = "B" else: grade = "A" print(f"Your grade is: {grade}")
3.5 Boolean Expressions and 3.6 Conditionals | Compci Blogs
3.5 Boolean Expressions and 3.6 Conditionals
https://nighthawkcoders.github.io/teacher/2023/10/09/P1_Booleans_IPYNB2.html