Skip to content

Instantly share code, notes, and snippets.

@lol97
Created January 2, 2019 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lol97/d0ed2e643db23538a1d9bc87afdd4d93 to your computer and use it in GitHub Desktop.
Save lol97/d0ed2e643db23538a1d9bc87afdd4d93 to your computer and use it in GitHub Desktop.
Soal nomor 1
'''
code by : Sufyan Saori (xsufyan@gmail.com)
soal1:
hitung hasil dari luas nilai x dan y dari tabel berikut dengan xawal=0 dan xakhir=6 dan h=2
tabel_awal = [[3,10],[5,10],[7,8],[9,8],[11,8],[13,5],[15,3]]
tabel_tengah = [[4,10],[6,7],[8,8],[10,8],[12,5],[14,3]]
format list [[x1,y1],...,[xn,yn]]
'''
def hitung_luas_mode_titik_tengah(tabel_nilai,h):
total_y_half = 0
for value in tabel_nilai:
total_y_half+=value[1]
return h*total_y_half
def main():
tabel_tengah = [[4,10],[6,7],[8,8],[10,8],[12,5],[14,3]]
print("nilai luasnya adalah : ",hitung_luas_mode_titik_tengah(tabel_tengah,2))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment