Skip to content

Commit

Permalink
Csv change.
Browse files Browse the repository at this point in the history
Now it will make differnet csv file for differnet  classes
  • Loading branch information
pritam12426 committed Jan 14, 2023
1 parent f728f0f commit cec7fec
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
20 changes: 17 additions & 3 deletions Main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
from playsound import playsound

mylist = ['Name','English','Maths','Hindi','Sst','Science','Total Marks','Percentage']
while(True):
try:
Class = int(input("Inset only Class name in numbers: "))
if 0<=Class and 12>=Class:
break
else:
print("\tError: The marks must be between 0 and 12.")
playsound('Porgram_Data/Error.wav')
except:
playsound('Porgram_Data/Error.wav')
print("\tTry again")

Class_section = input(f"Inset the the section fo class {Class}: ")

with open('Percentage_Output.csv', 'w') as f:
with open(f'Output/Percentage_Output_of_class_{Class}{Class_section.capitalize()}.csv', 'w') as f:
for hedder in mylist:
f.write(str(hedder))
if hedder != 'Percentage':
Expand All @@ -14,7 +27,7 @@
if student_name.find("Exit") == 0:
break
else:
with open('Percentage_Output.csv','a') as file_write:
with open(f'Output/Percentage_Output_of_class_{Class}{Class_section.capitalize()}.csv','a') as file_write:
file_write.write(f"\n{str(student_name)},")

total_marks = 0
Expand All @@ -36,7 +49,8 @@
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}%"))
file_write.write(str(f"{'%.2f'% percentage}%,"))
playsound('Porgram_Data/pop.wav')

if percentage>=60:
print(f"\t{student_name} got {'%.2f'% percentage}% and passed with first divison.\n")
Expand Down
3 changes: 3 additions & 0 deletions Output/Percentage_Output_of_2E.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name,English,Maths,Hindi,Sst,Science,Total Marks,Percentage
Pritam,65.0,98.0,78.0,25.0,65.0,331.0/500,66.20%,
Aman,58.0,15.0,25.0,75.0,65.0,238.0/500,47.60%,
File renamed without changes.
File renamed without changes.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![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.
### 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.
----
* Inside the function, we first initialize two variables: `total_marks` and `marks.` `Total_marks` represents the total number of marks that can be obtained for the 5 subjects, and `marks` represents the number of marks the user has obtained. We set `total_marks` to 0 and `marks` to 0 at the beginning, since no marks have been obtained yet.

Expand All @@ -11,9 +11,9 @@ total_marks = 0
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 +=1
file_write.write(str(f"{marks},"))
>>> marks = float(input(f"Inset the mark of {student_name} in subject {subject}: "))
>>> total_marks +=1
>>> file_write.write(str(f"{marks},"))
```

* After the marks have been obtained, the program adds 100 to the `total_marks` (since each subject is worth 100 marks) and adds the user's marks to `marks`. This allows us to keep track of the total number of marks available and the number of marks the user has obtained.
Expand All @@ -22,22 +22,20 @@ 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.

## Installation instructions
## :package: **Installation instructions**
### The easiest way to use this Percentage calculator:
1. Click [here](https://github.com/pritam12426/Percentage-Calculator/releases) to download Percantage Calculater
2. Eextract the `Percentege.zip` file
1. Click [**here**](https://github.com/pritam12426/Percentage-Calculator/releases) to download the `Package.zip` file
2. Unzip the `Package.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 `Percantage_Calculater` folder
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` 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 ❗
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.
* Don not delete or move the output folder.
* You can delete the csv file of output folder.
* If you delete output folder then make a foler with same name Output
## :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.
<!-- ## Need help
### Can some one help me to Ceate the gui for this program -->
- [ ] Currently **`GUI`** **(Graphical user interface)** is not Ceated for this project.

0 comments on commit cec7fec

Please sign in to comment.