-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Sankalp-sa/patch-1
Create sankalp.py
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Get the student's name and marks as input | ||
student_name = input("Enter the student's name: ") | ||
marks = float(input("Enter the student's marks: ")) | ||
|
||
# Calculate the grade based on the provided rules | ||
if 100 >= marks >= 75: | ||
grade = "A" | ||
elif 75 > marks >= 65: | ||
grade = "B" | ||
elif 65 > marks >= 55: | ||
grade = "C" | ||
elif 55 > marks >= 35: | ||
grade = "S" | ||
elif 35 > marks >= 0: | ||
grade = "F" | ||
else: | ||
print("Invalid marks entered. Marks should be between 0 and 100.") | ||
exit() | ||
|
||
# Print the grade of the student | ||
print(f"Grade for {student_name}: {grade}") | ||
|