• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Jul 17th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # a = []
2. # for i in range (0, 3):
3. #     nilai = int(input("Masukkan nilai matkul ke "+str(i+1)+" Siswa A : "))
4. #     a.append(nilai)
5. # sum1 = 0
6. # avg1 = 0
7. # for each in a:
8. #     sum1 = sum1 + each
9. #     avg1 = sum1 / len(a)
10. # b = []
11. # for i in range (0, 3):
12. #     nilai = int(input("Masukkan nilai matkul ke "+str(i+1)+" Siswa B : "))
13. #     b.append(nilai)
14. # sum2 = 0
15. # avg2 = 0
16. # for each in b:
17. #     sum2 = sum2 + each
18. #     avg2 = sum2 / len(b)
19. # c = []
20. # for i in range (0, 3):
21. #     nilai = int(input("Masukkan nilai matkul ke "+str(i+1)+" Siswa C : "))
22. #     c.append(nilai)
23. # sum3 = 0
24. # avg3 = 0
25. # for each in c:
26. #     sum3 = sum3 + each
27. #     avg3 = sum3 / len(c)
28. # nilai= [avg1, avg2, avg3]
29. # print ("\nRata-rata Nilai A :",avg1)
30. # print ("Rata-rata Nilai B :",avg2)
31. # print ("Rata-rata Nilai C :",avg3)
32. # print ("Nilai tertinggi :",max(nilai))
33. # print ("Nilai terendah :",min(nilai))
34.
35. import pandas as pd
36.
37. amountStudent = input("Masukkan Jumlah Siswa : ")
38. amountStudent = int(amountStudent)
39.
40. class Student:
41.     id_std = ''
42.     name = ''
43.     result = None
44.
45.     def __init__(self, id_std, name, mtk, ipa, ips):
46.         self.id_std = id_std
47.         self.name = name
48.         self.mtk = mtk
49.         self.ipa = ipa
50.         self.ips = ips
51.
52. students = dict()
53.
54. for i in range(amountStudent):
55.     counter = i+1
56.
57.     line_nik = 'NIK Siswa ke-'+ str(counter) + ' : '
58.     line_name = 'Nama Siswa ke-'+ str(counter) + ' : '
59.     line_mtk = 'Nilai MTK Siswa ke-'+ str(counter) + ' : '
60.     line_ipa = 'Nilai IPA Siswa ke-'+ str(counter) + ' : '
61.     line_ips = 'Nilai IPS Siswa ke-'+ str(counter) + ' : '
62.
63.     id_std = input(line_nik)
64.     name = input(line_name)
65.     mtk = input(line_mtk)
66.     ipa = input(line_ipa)
67.     ips = input(line_ips)
68.
69.     print()
70.
71.     student = Student(id_std, name, mtk, ipa, ips)
72.     students.update({int(counter):
73.                             {'id_std': id_std,
74.                             'name': name,
75.                             'mtk': mtk,
76.                             'ipa': ipa,
77.                             'ips': ips}
78.                     })
79.
80. result_mtk = []
81. result_ipa = []
82. result_ips = []
83.
84. for j in students:
85.     mtk = students[j]['mtk']
86.     ipa = students[j]['ipa']
87.     ips = students[j]['ips']
88.
89.     avg = (int(mtk) + int(ipa) + int(ips)) / 3
90.
91.     print("Rata-rata nilai " + students[j]['name'] + ' : ' + str(avg))
92.
93.     if avg <= 100 and avg >= 80:
94.         print("Nilai huruf adalah : A")
95.     elif avg < 80 and avg >= 60:
96.         print("Nilai huruf adalah : B")
97.     elif avg < 60 and avg >= 40:
98.         print("Nilai huruf adalah : C")
99.     elif avg <= 40:
100.         print("Nilai huruf adalah : D")
101.     else:
102.         print("Salah angka")
103.
104.     print()
105.
106.     result_mtk.append(int(students[j]['mtk']))
107.     result_ipa.append(int(students[j]['ipa']))
108.     result_ips.append(int(students[j]['ips']))
109.
110. print(result_mtk)
111. print(max(result_mtk))
112. print(min(result_mtk))
113. print(result_ipa)
114. print(max(result_ipa))
115. print(min(result_ipa))
116. print(result_ips)
117. print(max(result_ips))
118. print(min(result_ips))
119.
120. print("Nilai tertinggi di mata pelajaran MTK :",(max(result_mtk)))
121. print("Nilai tertinggi di mata pelajaran IPA :",(max(result_ipa)))
122. print("Nilai tertinggi di mata pelajaran IPS :",(max(result_ips)))
123. print("Nilai terendah di mata pelajaran MTK :",(min(result_mtk)))
124. print("Nilai terendah di mata pelajaran IPA :",(min(result_ipa)))
125. print("Nilai terendah di mata pelajaran IPS :",(min(result_ips)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top