# conditional statements # simple if then else #breakpoint (#breakpoint is for use of the program breakpoint_1.py) age = 21 if age >= 18: print("You may vote.") #breakpoint # simple if then else #breakpoint predicted_value = 0.85 threshold = 0.7 if predicted_value >= threshold: prediction_outcome = "Positive" else: prediction_outcome = "Negative" print(f"Prediction outcome: {prediction_outcome}") #breakpoint # using short hand form. predicted_value_2 = 0.85 threshold_2 = 0.7 prediction_outcome_2 = "Positive" if predicted_value_2 >= threshold_2 else "Negative" print(f"Prediction outcome (shorthand): {prediction_outcome_2}") #breakpoint # DS: Long form text_data = "Data science is fascinating." keyword = "science" if keyword in text_data: contains_keyword = True else: contains_keyword = False print(f"Contains keyword: {contains_keyword}") #breakpoint # DS: Short form text_data = "Data science is very fascinating." keyword = "science" contains_keyword_2 = True if keyword in text_data else False print(f"Contains keyword (shorthand): {contains_keyword_2}") #breakpoint # DS: Not using conditionals. text_data = "Data science is very, very fascinating." keyword = "science" contains_keyword_3 = keyword in text_data print(f"Contains keyword (shorthand): {contains_keyword_3}") #breakpoint # elif score = 75 if score >= 90: grade = 'A' elif score >= 80: grade = 'B' elif score >= 70: grade = 'C' elif score >= 60: grade = 'D' else: grade = 'F' print(f"Grade: {grade}")