Penyelesaian Problem Bank Darah Kelas 11 [Bag. 2]
Summary
TLDRThe video script is a tutorial by an IT teacher from a high school in South Sumatra, Indonesia, discussing how to solve a problem from an 'Informatics' textbook for 11th graders using the Merdeka curriculum. The problem involves calculating the number of blood donors and the volume of blood that can be donated in each village, categorized by blood type. The script explains the input format, which includes the number of donors and villages, followed by donor data. The solution involves creating a two-dimensional array to store donor counts and blood volume for each village and blood type. The script also includes a Python function to process the data and calculate the required outputs, which are then compared to an example from the textbook to ensure accuracy.
Takeaways
- 😀 The video is a tutorial by an Information Technology teacher from a high school in South Sumatra, Indonesia.
- 📚 The tutorial covers problem-solving from an 'Informatics' textbook for 11th graders, focusing on blood bank management.
- 🔍 The specific problem discussed is 'subpr 2' which involves calculating the number of blood donors and the volume of blood that can be donated in each village.
- 💻 The input format for the problem includes the number of blood donors, the number of villages, and detailed donor information for each village.
- 📊 The output format requires displaying the number of donors and the total volume of blood for each blood type in every village.
- 💡 The tutorial explains how to initialize variables and arrays to store donor information and calculate the required statistics.
- 🔢 The script includes a detailed walkthrough of the coding process in Python, including loops and list comprehensions.
- 🔡 Blood types are represented numerically, with A=1, B=2, AB=3, and O=4, and these values are used to index arrays.
- 💼 The tutorial demonstrates how to process input data, which includes splitting strings and converting them into integers for array indexing.
- 📝 The final part of the script involves running the code and comparing the output with the expected results from the textbook example.
Q & A
What is the main topic discussed in the video script?
-The main topic discussed in the video script is solving a problem from an Information Technology textbook for 11th-grade students, specifically focusing on managing a blood bank and calculating the number of blood donors and the volume of blood that can be donated in each village.
What is the book's title and author mentioned in the script?
-The book's title is 'Informatica' and it is written by Auzi Asparian, with the first edition published in 2021.
What was the focus of the previous video by the teacher?
-In the previous video, the teacher discussed Subpr 1 of the Blood Bank problem, which involved calculating the number of voluntary blood donors.
What is the specific problem the teacher attempts to solve in this video?
-In this video, the teacher attempts to solve Subpr 2, which requires calculating the number of blood donors and the volume of blood that can be donated in each village.
What is the format of the input data as described in the script?
-The input data format consists of an integer 'n' representing the number of voluntary blood donors, followed by an integer 'm' representing the number of villages. Each of the following 'n' lines contains three pieces of information: village code, blood type, and the volume of blood that can be donated.
How are blood types represented in the input data?
-Blood types in the input data are represented by numbers: A=1, B=2, AB=3, and O=4.
What is the expected output format according to the script?
-The expected output format is the number of donors and the total volume of blood available in each village, categorized by blood type.
How does the teacher initialize the variables and arrays in the Python code?
-The teacher initializes variables 'n' and 'm', and uses a list comprehension to create a two-dimensional array to store the number of donors and the total volume of blood for each village and blood type, initializing all values to zero.
What is the purpose of the loop in the Python code discussed in the script?
-The loop in the Python code is used to iterate through each donor's data, updating the number of donors and the total volume of blood for the corresponding village and blood type.
How does the script handle the conversion of blood type from string to integer?
-The script converts blood types from string (1, 2, 3, 4) to integer by subtracting 1 from the string value to match the zero-based index of the array.
What is the final step the teacher takes to validate the solution?
-The final step is to call the 'hitung_donor' function with the initialized variables and input data, and then compare the output of the code with the expected output from the textbook to ensure it matches.
Outlines
😀 Introduction to Blood Donation Management
The speaker, a computer science teacher from a high school in South Sumatra, begins by greeting the audience and introducing the topic of blood donation management. The discussion revolves around solving a problem from a computer science textbook for 11th graders, focusing on calculating the number of blood donors and the volume of blood that can be donated in each village. The problem is set within the context of managing a blood bank, and the teacher refers to a previous video where they discussed a related subproblem involving calculating the number of voluntary blood donors. The input format for the problem is described, which includes the total number of voluntary blood donors and the number of villages, followed by detailed donor information for each village.
👨💻 Coding Strategy for Blood Donation Calculation
The speaker proceeds to explain the coding strategy for solving the blood donation problem. They outline the initialization of variables and the creation of a two-dimensional array to store donor information, including the number of donors and the total volume of blood for each village and blood type. The speaker emphasizes the importance of initializing the array with zeros and then updating it based on the donor data. The process involves iterating through each donor's data, updating the count of donors and the total volume of blood donated for each blood type in each village. The speaker also discusses the need to convert blood type strings into integer indices to match the array indices, which start from zero.
📝 Processing Donor Data Input
The speaker moves on to discuss the input of donor data, which involves creating an empty list to store the donor information. Each element in the list represents a donor with details such as village code, blood type, and blood volume. The process includes a loop that iterates through the number of voluntary blood donors, collecting input from the user, splitting it into parts, and converting the blood type from a string to an integer. The speaker demonstrates how to add the processed donor data to the list and prepare it for the calculation function. They also mention the importance of careful input to ensure the correct processing of data.
🔍 Validation and Conclusion
Finally, the speaker validates the coding solution by comparing the output with the expected results provided in the textbook. They input the number of donors and villages as per the example and execute the code to check the output against the textbook's sample output. The results match, indicating that the code correctly calculates the number of donors and the total volume of blood donated for each blood type in each village. The speaker concludes by expressing hope that the explanation is beneficial for learning and ends the session with a farewell greeting.
Mindmap
Keywords
💡Informatics
💡Blood Bank Management
💡Donor
💡Desa
💡Volume of Blood
💡Programming
💡List Comprehension
💡Looping
💡Input and Output
💡Blood Type
💡Array
Highlights
Introduction to the discussion on solving problems from the 'Informatics' textbook for 11th grade, curriculum Merdeka, authored by Auzi Asparian, first edition 2021.
Focus on Subpr 2, which involves calculating the number of blood donors and the volume of blood that can be donated in each village.
Reference to the problem of blood bank management from page 60 of the textbook.
Input format similar to Subpr 1, with the first line containing the number of voluntary blood donors (n), and the second line containing the number of villages (m).
Each subsequent line contains three pieces of information: village code, blood type, and volume of blood that can be donated.
Village code is an integer from 1 to m, and the volume of blood is an integer from 0 to 500.
The output format includes the number of donors and the total volume of blood available in each village based on blood type.
An example input is provided on page 64, with 8 voluntary blood donors and 3 villages, followed by their respective data.
Blood types are represented by numbers: A=1, B=2, AB=3, and O=4.
Coding approach in Python is introduced, starting with initializing variables and creating a two-dimensional array to store donor data.
The two-dimensional array is initialized with zeros, with rows representing villages and columns representing blood types.
Looping through each donor's data to update the number of donors and total blood volume for each blood type in each village.
Conversion of blood type from string to integer is necessary to match the array index, which starts from 0.
The program accurately displays information on the number of donors and total blood volume based on blood type and village.
Data input for donors involves initializing an empty list to store donor data, with each element being a tuple containing village code, blood type, and blood volume.
A loop is used to process each donor's data, splitting the input string into village code, blood type, and blood volume.
The function 'hitung_donor' is called with variables n, m, and data to process the donor information.
The final output is compared with the example output in the textbook to ensure the program meets the problem requirements.
The conclusion emphasizes the practical application of the coding solution in blood bank management and its educational value.
Transcripts
asalamualaikum warahmatullahi
wabarakatuh kembali bertemu dengan saya
arah guru Informatika SMA Negeri
Sumatera Selatan kali ini kita akan
membahas
penyelesaian soal pada buku
Informatika kelas 11 ya kurikulum
Merdeka tulisan dari auzi
asparian cetakan pertama 2021
terbitan dari Pusat perbukuan Badan
standar kurikulum dan asesmen pendidikan
Kementerian Pendidikan Kebudayaan riset
dan
teknologi pada video terdahulu kita
sudah membahas
tentang subpr 1 dari Bank Darah yaitu
menghitung jumlah pendonor
darah di mana pada S ini kita menghitung
jumlah pendonor darah sukarela atau S di
setiap desa nah pada video kali ini saya
akan mencoba menyelesaikan subpr 2 di
mana pada gambar
2.16 kita diminta untuk menghitung
jumlah pendonor darah dan volume darah
yang dapat didonorkan di masing-masing
desa soalnya tetap ya kita eh mengacu
kepada problem pengelolaan Bank Darah
halaman 60 kita langsung lihat saja
deskripsinya Seperti
apa format masukan sama dengan subpr 1
Ya baik eh karena dia format pasukannya
sama dengan subpr 1 kita lihat kembali
format masukan pada sub 1 baris pertama
adalah sebuah bilangan bulat n yang
merupakan jumlah DDS ya donor darah
sukarela Nilai N ini paling banyak
berjumlah 1000 orang
baris kedua adalah m yang merupakan
jumlah desa yang paling banyak berjumlah
10 desa n baris berikutnya masing-masing
akan terdiri atas tig buah informasi
yaitu kode Desa golongan darah dan
volume darah yang
dapat kode desa merupakan sebuah
bilangan bulat dari 1 sampai m sedangkan
volume darah yang dapatkan adalah sebuah
bilangan bulat dari 0 hingga
500 baik berarti nanti tetap kita akan
membuat seperti pada satu kita akan
membagi coding kita ee berdasarkan
output yang diberikan oleh user atau
pengguna menjadi kode dsa golongan darah
dan volume darah ya Di mana kita akan
membuat eh baris pertama itu ada nilai
bilangan bulat n yang mewakili DDS
kemudian ada bilangan bulat m yang
mewakili dari banyak desa atau jumlah
desa nah kali ini pada format keluaran
pada
kedu keluaran berupa jumlah pendonor dan
total volume darah yang ada di
masing-masing desa berdasarkan golongan
darahnya ikuti format yang ada di contoh
keluaran berikut ada tabel
2.9 di mana ada contoh masukan bisa kita
lihat bersama pada halaman
64 jadi 8 itu adalah DDS kemudian angka
t ini mewakili jumlah
desa selanjutnya ada t 1 150 kita ingat
bahwa golongan darah itu diwakilkan
dengan angka ya seperti yang ada di sini
catatan di mana golongan darah AB akan
dinyatakan sebagai t golongan darah A =
1 b = 2 dan O = 4 nah
bagaimana codingnya di dalam
Python baik saya akan buka kembali saya
menggunakan editor
gini di sini Saya sudah
membuat
fungsi hitung donor ya sebuah fungsi
hitung donor di mana Di sana kita
inisialisasikan variabel n variabel m
dan variabel
data inisialisasi array untuk menyimpan
donor eh untuk menyimpan jumlah pendor
dan total volume darah di sini saya
menggunakan array du dimensi di mana
akan ada jumlah pendonor dan juga total
volume kalau
dilihat rumus jumlah pendonor sama 0 * 4
ya
for und in range m ini adalah
ekspresi list comprehension yang
menciptakan array du dimensi itu sendiri
ekspresi ini nantinya akan membuat
sebuah list yang berisi m elemen di mana
setiap elemen adalah list yang berisi
EMP angka 0 Saya ulangi nanti
ekspresi yang
akan dinyatakan di sini akan membuat
sebuah list yang berisi m
elemen ya dan setiap elemen adalah list
yang berisi 4 angka 0 artinya nanti kita
akan memiliki m baris dan 4 kolom m
baris dan 4 kolom di mana setiap elemen
akan memiliki nilai awalnya 0
ya jumlah pendonor ini juga adalah array
yang nanti digunakan untuk menyimpan
jumlah pendonor berdasarkan golongan
darahnya dari setiap desa misalnya
jumlah pendonor
i j akan akan menyimpan jumlah pendonor
golongan darah ke J di desa ke
I total volume ya total volume ini
adalah array yang digunakan untuk
menyimpan total volume darah yang
didonorkan berdasarkan golongan darah di
masing-masing desa misalnya total volume
IJ akan menyimpan total volume Volume
darah
dari pendonor golongan darah ke J di
desa ke
I dengan menggunakan ekspresi list ini
kita akan dapat dengan cepat
menginisialisasi
array dua dimensi dengan nilai awal 0
sesuai dengan jumlah desa dan golongan
darah yang telah
ditentukan Sekarang kita akan membahas
bagian selanjutnya di sini ada sebuah
iterasi ada sebuah looping atau
perulangan ya untuk memproses setiap
data pendonor seperti bisa dilihat di
situ ada for kode Desa golongan darah
volume darah in data nah ini adalah Loop
atau for yang akan mengiterasi melalui
setiap elemen dalam data di mana setiap
elemen dalam data tadi akan berisi
informasi tentang kode Desa golongan
darah dan volume darah dari seorang
pendonor indeks golongan ya di sini ada
indeks golongan indeks golongan sama
dengan integer golongan darah
1 ini merupakan eh variabel yang akan
digunakan untuk menentukan indeks di
dalam array jumlah pendonor dan juga
total volume berdasarkan golongan darah
pendonor karena golongan darah disajikan
dalam bentuk string 1 2 3 atau 4 ya kan
tadi seperti J kita ingat bahwa
masing-masing golongan darah A B AB dan
o akan diinisialisasikan dengan string 1
2 3 dan
4 maka kita perlu mengkonversinya
menjadi angka integer dan dikurangi 1
untuk mencocokkan indek array dimulai
dari 0
ya jadi saya
ulangi karena golongan darah disajikan
dalam bentuk string 1 2 3 dan 4 maka
kita perlu melakukan konversi menjadi
angka atau bilangan integer dan
dikurangi
1 untuk mencocokkan indek array dimulai
dari
0 Nah untuk jumlah ya untuk jumlah
pendonor bisa Nah untuk jumlah pendonor
baris ini akan menambahkan satu ke
jumlah pendonor dengan golongan darah
yang
sesuai agar dia bisa mengakses elemen di
indeks kode Desa 1 di dalam array jumlah
pendonor dan menambahkan satu ke indeks
yang sesuai yaitu indeks
golongan seperti bisa dilihat total
volume ada kode
desa1 indeks golongan plus sama dengan
volume darah nah baris ini menambahkan
volume darah yang didonorkan oleh
pendonor ke total volume darah untuk
golongan darah yang sesuai di desa
masing-masing
ini agar kita bisa mengakses elemen di
indeks kode desa -1 di dalam array total
volume dan akan menambahkan volume darah
ke indeks yang sesuai yaitu indeks
golongan
ya dengan menggunakan Loop for dan
indeks yang dihitung
maka program akan dapat dengan tepat
mengampil
informasi dari jumlah pendonor dan total
volume darah berdasarkan golongan darah
dan desa yang
sesuai Sekarang kita akan membahas di
bagian input
data
pendonor data di sini ya merupakan
inisialisasi sebuah list kosong yang
akan digunakan untuk menyimpan data
pendonor setiap elemen dalam list ini
akan berupa tel yang berisi tiga nilai
yaitu kode desa yang merupakan bilangan
integer golongan darah juga integer dan
volume darah yaitu bilangan integer juga
for i in range n ini adalah Loop for
yang berjalan sebanyak n kali di mana n
adalah Jumlah dari DDS atau donor darah
sukarela iterasi ini bertujuan untuk
mengambil input data pendonor sebanyak n
kali Adapun kode Desa golongan darah
volume
darahama
yaput ini akan mengambil input dari
pengguna dalam bentuk string kemudian
membaginya menjadi beberapa bagian
Menggunakan fungsi split ya Jadi sama
seperti pada kasus subpr 1 di mana kita
akan membagi hasil daripada inputan dari
pengguna atau dari user menjadi tiga
bagian yaitu kode
Desa golongan darah dan volume darah
maka pada kasus subpr 2 ini pun kita
akan melakukan hal yang sama kita akan
menggunakan fungsi split Setelah itu
kita juga akan menggunakan fungsi map
yang akan diterapkan untuk mengkonversi
setiap bagian menjadi string sehingga
pada akhirnya nilai-nilai ini akan
diatribusikan ke variabel kode Desa
golongan darah dan volume
darah Adapun baris yang selanjutnya ini
ya
setelah kita mengkonversi nilai-nilai
input menjadi
integer tel yang berisi nilai-nilai
tersebut akan ditambahkan ke dalam list
data di mana setiap tel akan mewakili
satu entry data
pendonor terakhir kita akan memanggil
fungsi hitung donor di mana Di sana ada
variabel n ada variabel m dan ada
variabel
data kita akan coba sekarang
menjalankan coding kita ini apakah
sesuai dengan permintaan soal yang ada
di buku nih kita lihat kembali di sini
ada format keluaran
ee tabel
2.9 kita akan coba
jalankan jumlah DDS kita isikan 8
kemudian jumlah desa kita masukkan
3 sama seperti pada subpr 1 maka setelah
kita mengisikan jumlah desa kita harus
berhati-hati karena kita akan memasukkan
tiga bilangan yang akan dipisahkan oleh
spasi yang displit oleh e yang
dipisahkan oleh fungsi split
tadi
3 1 150
2
250 3 1
300 1 3
450 2 2
200
34
350
14
500 21500
Sekarang kita akan coba jalankan kita
eksekusi Nah kita dapat bandingkan
supaya kita lebih mudah melihatnya kita
akan coba cek antara contoh yang ada di
buku dengan hasil daripada koding kita
ya pada contoh keluaran yang ada di
tabel
2.9 berdasarkan masukan yang ada maka
1 golongan darah
A itu nol pendonor
dan praktis konsekuensinya pasti 0 ML
itu logikanya kita lihat output kita
golongan darah A itu 0 pendonor dan 0 ML
sama untuk golongan darah B ada satu
pendonor sebanyak 250
ml untuk golongan AB
ada satu
pendonor sebanyak 450
ML golongan darah O ada satu
pendonor sebanyak 500
ml jadi untuk desa 1 outputnya sudah
sesuai antara coding yang kita buat
dengan output yang diminta oleh tabel
2.9 Sekarang kita akan lihat pada
Desa Des
golongan darah A itu ada satu
pendonor sebanyak 500 ml golongan darah
B S pendonor 200
ml golongan darah AB ada 0 pendonor dan
0 ML golongan darah O = 0 pendonor 0
ML Dasa du juga sama sudah sesuai kita
cek untuk desa ketig a Dasa ketiga
pendonor untuk golongan darah A itu ada
dua ya ada dua orang
pendonor jumlahnya 450 ML golongan darah
B ada 0 pendonor jumlahnya 0 ML golongan
darah AB ada 0 pendonor sebanyak 0 ML
juga dan golongan Dara o 1 pendonor
sebesar atau sebanyak
350 ML
nah jika kita komparasi antara output
pada coding yang sudah kita buat dengan
contoh keluaran pada tabel 29 baik untuk
desa 1 Desa 2 dan desa 3 maka seluruh
outputnya sesuai
dengan apa yang menjadi permintaan pada
soal
mudah-mudahanoding ini bisa bermanfaat
dan dapat menjadi
dari pembelajaran bersama saya
armansyah guru Informatika SMA Negeri
Sumatera Selatan wasalamualaikum
warahmatullahi wabarakatuh
Посмотреть больше похожих видео
5.0 / 5 (0 votes)