creates a 4x4 2D array named my_2d_array containing strings, initialises an empty string variable named diagonal1 to store the concatenated elements along the main diagonal of the 2D array, the outer for row in range(len(my_2d_array)) loop iterates through the rows of the 2D array, the inner for col in range(len(my_2d_array[row])) loop iterates through the columns within each row, checks if the current row index is equal to the current col index. In which case, we have a diagonal, appends (concatenates) the string value at my_2d_array[row, col] to the diagonal1 string, prints the concatenated elements along the main diagonal by displaying the content of the diagonal1 variable.
0%
SDD Implementation - 2D arrays (Describing Code 3)
แชร์
แชร์
แชร์
โดย
Mrscalderwood
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
แผนภาพที่มีป้ายกำกับ
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม