Skip to content

Commit

Permalink
Now program will give a not notification to user.
Browse files Browse the repository at this point in the history
When user inset exit after that program will give a notification that (A file of name {Class}_{Class_section.upper()} is save in Output folder.)

* Notification
* New heading image in readme
  • Loading branch information
pritam12426 committed Jan 20, 2023
1 parent cc78a17 commit dc31011
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
30 changes: 24 additions & 6 deletions Main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import os
from playsound import playsound
from plyer import notification


if(not os.path.exists("Output")):
os.mkdir("Output")
while True:
try:
max_marks = int(input("Inset the Max of a single subject: "))
max_marks = int(input("Inset the maximum of a single subject: "))
break
except:
print("\tError: Maxume makrs must be number")
print("\tError: Maximum single subject makrs must be number")
playsound('Porgram_Data/Error.wav')

while(True):
Expand All @@ -24,7 +26,7 @@
print("\tError: Class must be a number")

while True:
Class_section = input(f"Inset the the section fo class : ")
Class_section = input(f"Inset the the section fo class: ")
if Class_section.isalpha():
if len(Class_section) == 1:
break
Expand All @@ -35,7 +37,7 @@
print("\tError: section must be a 'alphabetic characters'")
playsound('Porgram_Data/Error.wav')

file_name = "Percentage_Output_of_class_"
file_name = "Class_"

if(not os.path.exists(f'Output/{file_name}{Class}{Class_section.title()}.csv')):

Expand All @@ -46,10 +48,17 @@
if hedder != 'Percentage':
f.write(str(','))

h = 0
while True:
student_name = input("Insert the name of sudent or enter exit to close: ")
student_name = student_name.title()
if student_name.find("Exit") == 0:
if not h==0:
notification.notify(
title = "Percentage calculator",
message = f"A file of name {Class}_{Class_section.upper()} is save in Output folder.",
app_icon = "Porgram_Data/icon.ico",
timeout = 5)
break
else:
with open(f'Output/{file_name}{Class}{Class_section.title()}.csv','a') as file_write:
Expand All @@ -76,9 +85,10 @@
a = max_marks*len(subject_list)
percentage = (total_marks / a) * 100
percentage = float('%.2f'% percentage)
file_write.write(str(f"{total_marks}/{max_marks},"))
file_write.write(str(f"{total_marks}/{max_marks*len(subject_list)},"))
file_write.write(str(f"{percentage}%,"))
playsound('Porgram_Data/pop.wav')
h +=1

if percentage>=60:
print(f"\t{student_name} got {percentage}% and passed with first divison.\n")
Expand All @@ -87,4 +97,12 @@
elif percentage>=33:
print(f"\t{student_name} got {percentage}% and passed with third divison.\n")
else:
print(f"\t{student_name} got {percentage}% and {student_name} is fail\n")
print(f"\t{student_name} got {percentage}% and {student_name} is fail\n")

# if not h ==0:
# notification.notify(
# title = "Percentage calculator",
# message = f"A file {Class ,Class_section} save in Output folder",
# app_icon = "Porgram_Data/icon.ico",
# timeout = 3
# )
Binary file added Porgram_Data/icon.ico
Binary file not shown.
Binary file added Porgram_Data/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Porgram_Data/percange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![temporary](https://user-images.githubusercontent.com/84720825/212024726-9a0f0c47-597c-4683-bc81-880949263eb2.png)
![Percentage Calculate](https://user-images.githubusercontent.com/84720825/213391657-b3ca1797-37be-4562-bddf-748ac8a72ec1.png)

### The function Percentage calculator asks the user for their marks in 5 subjects, calculate the percentage, and prints the result and provide the result in a *Excel* file.
----
Expand Down Expand Up @@ -32,9 +32,11 @@ for subject in subject_list:
4. Run this **`.exe`** file of`Percantage_Calculater` at last of that foler
5. Start Inserting the data as per given ***instruction***
6. At last you will get `Percentage_Output.csv` in output file and it will look like this in Excel 👇
![](https://user-images.githubusercontent.com/84720825/212041632-814f0704-3797-4f66-b458-226e1c65bf9f.png)
## :page_with_curl: **Important note**
* If you wants to save the program Inset `exit` while Inset the name of student.
![CHOTI-DHNNO_Visual-Studio-Code_2023_01_20_9](https://user-images.githubusercontent.com/84720825/213683162-4b5cf19f-434a-44cd-bd72-767ac8b6c36d.png)* If you wants to save the program Inset `exit` while Inset the name of student.

## :traffic_light: **Known issues**
- [x] You have to use terminal to run this program.
- [ ] Currently **`GUI`** **(Graphical user interface)** is not Ceated for this project.
- [ ] Currently **`GUI`** **(Graphical user interface)** is not Ceated for this project.

## Feedback
If you have any feedback, please reach out to us at [here](https://github.com/pritam12426/Percentage-Calculator/issues/new)

0 comments on commit dc31011

Please sign in to comment.