Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

Write a python program that prompts the user to enter the GPA and displays a message…

  1. User

    Write a python program that prompts the user to enter the GPA and displays a message showing the letter GPA and whether this student is accepted in the MSc. Program based on the following criteria. If the student has a GPA >=3.0, then he/she will be admitted. If the student has a GPA>2.5, then he/she will be admitted with probation. Otherwise, he/she will not be allowed to join the program.

  2. Assistant
    gpa = float(input("Enter your GPA: "))
    
    if gpa >= 3.0:
        print("Congratulations! You have been accepted into the MSc. Program.")
    elif gpa > 2.5:
        print("Congratulations! You have been admitted into the MSc. Program with probation.")
    else:
        print("Sorry, you are not allowed to join the MSc. Program.")
    

    Explanation:

    1. The user is prompted to enter their GPA using the input() function. The result is stored in the variable gpa, which is converted to a floating-point number using float().

    2. The first condition if gpa >= 3.0: checks if the GPA is greater than or equal to 3.0. If true, it prints a congratulatory message stating that the student has been accepted into the MSc. Program.

    3. The elif gpa > 2.5: condition checks if the GPA is greater than 2.5, which means it is less than 3.0. If true, it prints a message stating that the student has been admitted into the MSc. Program with probation.

    4. If both the previous conditions are false, then the else block executes and prints a message stating that the student is not allowed to join the MSc. Program.