Skip to content

Commit

Permalink
Now program will carry a exit perimeter
Browse files Browse the repository at this point in the history
  • Loading branch information
pritam12426 committed Jan 13, 2023
1 parent 51925db commit dd139d1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 46 deletions.
65 changes: 34 additions & 31 deletions Main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from playsound import playsound

mylist = ['Name','English','Maths','Hindi','Sst','Science','Percentage']
mylist = ['Name','English','Maths','Hindi','Sst','Science','Total Marks','Percentage']

with open('Percentage_Output.csv', 'w') as f:
for hedder in mylist:
Expand All @@ -9,37 +9,40 @@
f.write(str(','))

while True:
student_name = input("Insert the name of sudent: ")
student_name = input("Insert the name of sudent or enter exit to close: ")
student_name = student_name.lower().capitalize()

with open('Percentage_Output.csv','a') as file_write:
file_write.write(f"\n{str(student_name)},")
if student_name.find("Exit") == 0:
break
else:
with open('Percentage_Output.csv','a') as file_write:
file_write.write(f"\n{str(student_name)},")

total_marks = 0
subject_list = ['English','Maths','Hindi','Sst','Science']
total_marks = 0
subject_list = ['English','Maths','Hindi','Sst','Science']

for subject in subject_list:
while True:
try:
marks = float(input(f"Inset the mark of {student_name} in subject {subject}: "))
if 0<=marks and 100>=marks: # Enter a number that is geater then 0 and smaller 100 then this sentex will break the while loop
break
else:
print("\tError: The marks must be between 0 and 100.")
playsound('Contents/Error.wav')
except ValueError:
print("\tError: The Insert Value must be a number.the")
playsound('Contents/Error.wav')
total_marks += marks
file_write.write(str(f"{marks},"))
percentage = (total_marks / 500) * 100
file_write.write(str(f"{'%.2f'% percentage}%"))
for subject in subject_list:
while True:
try:
marks = float(input(f"Inset the mark of {student_name} in subject {subject}: "))
if 0<=marks and 100>=marks:
break
else:
print("\tError: The marks must be between 0 and 100.")
playsound('Porgram_Data/Error.wav')
except ValueError:
print("\tError: The Insert Value must be a number.")
playsound('Porgram_Data/Error.wav')
total_marks += marks
file_write.write(str(f"{marks},"))
percentage = (total_marks / 500) * 100
file_write.write(str(f"{total_marks}/500,"))
file_write.write(str(f"{'%.2f'% percentage}%"))

if percentage>=60:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with first divison.\n")
elif percentage>=40:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with secound divison.\n")
elif percentage>=33:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with third divison.\n")
else:
print(f"\t{student_name} got {'%.2f'% percentage}% and {student_name} is fail\n")
if percentage>=60:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with first divison.\n")
elif percentage>=40:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with secound divison.\n")
elif percentage>=33:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with third divison.\n")
else:
print(f"\t{student_name} got {'%.2f'% percentage}% and {student_name} is fail\n")
File renamed without changes.
File renamed without changes.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Percentage-calculator
![temporary](https://user-images.githubusercontent.com/84720825/212024726-9a0f0c47-597c-4683-bc81-880949263eb2.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 *Percentage_output.csv* file.
----
Expand All @@ -12,7 +12,7 @@ subject_list = ['English','Maths','Hindi','Sst','Science']

for subject in subject_list:
marks = float(input(f"Inset the mark of {student_name} in subject {subject}: "))
total_marks = total_marks + marks
total_marks +=1
file_write.write(str(f"{marks},"))
```

Expand All @@ -22,21 +22,22 @@ for subject in subject_list:

* Finally, the program prints the percentage to the user using the `print` function and the `f` string format. The `f` string allows us to embed the value of the `percentage` variable directly into the string, so that the user can see their percentage.

## This is the output example of *Percentage_output.csv*
![CHOTI-DHNNO_EXCEL_2023_01_11_70](https://user-images.githubusercontent.com/84720825/211838001-d27f2a20-c98d-43c9-87a2-1ef6c53d2e37.png)

## Installation instructions
### The easiest way to use this Percentage calculator:
1. Click [here](https://github.com/pritam12426/Percentage-Calculator/releases) to download the last portable version
2. Eextract the `Percentege.zip`
3. After that open Percentege
1. Click [here](https://github.com/pritam12426/Percentage-Calculator/releases) to download Percantage Calculater
2. Eextract the `Percentege.zip` file
3. After that open `Percantage_Calculater` folder

![CHOTI-DHNNO_2023_01_12_75](https://user-images.githubusercontent.com/84720825/211976108-d58549a6-6550-459c-9987-d75d770d1500.png)
4. Run this **`.exe`** file of that folder
5. then you will see this screen
![CHOTI-DHNNO_2023_01_12_69](https://user-images.githubusercontent.com/84720825/211970030-f0f68caa-152b-4cbe-8414-9e3b28fc1795.png)
6. Start Inserting the data as per given ***instruction***
7. And you are good to go

## Known issues
4. Run this **`.exe`** file of `Percantage_Calculater` folder
5. Start Inserting the data as per given ***instruction***
6. At last you will get `Percentage_Output.csv` just behind of that `.exe` and look like this in Excel 👇

![CHOTI-DHNNO_2023_01_12_71](https://user-images.githubusercontent.com/84720825/212041632-814f0704-3797-4f66-b458-226e1c65bf9f.png)

## 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.
<!-- ## Need help
### Can some one help me to Ceate the gui for this program -->

0 comments on commit dd139d1

Please sign in to comment.