Answer:
Following are the code to this question:
def fun():#defining a method fun
while True:#defining a while loop
g = input("Enter your grade: (I graduated) ")#defining variable g for input value
if g == "I graduated":#defining if block to check string value
return 0#return
print("{} is a fun grade".format(g))#use print method to print string value
fun()#calling the method
Output:
Enter your grade: (I graduated) 1st
1st is a fun grade
Enter your grade: (I graduated) 2nd
2nd is a fun grade
Enter your grade: (I graduated) I graduated
Explanation:
In the given python code, a method "fun" is defined, and inside the method, a while loop is defined, which uses a variable "g" for input value from the user-end.
In the next step, if block is defined to check string a value and return a value 0, and use the print method to print the given value, and call the above method fun.