Python program to take input in 2D Array.
Complete playlist for different ways of input in the array as asked in coding questions: • Array Input in Python
Code -
"""
Input Format
R C (Number of Rows and Columns)
Value11 Value12 Value13 ......
Value21 Value22 Value23 ......
Value31 Value32 Value33 ......
....... ....... ....... ......
Sample Input:
4 2
Uttar Pradesh
West Bengal
New Delhi
Madhya Pradesh
"""
Taking the values of R and C.
R_and_C = input().split() # "4 2"
R = int(R_and_C[0]) # 4
C = int(R_and_C[1]) # 2, But we will not use this value.
values = []
for i in range(R):
values.append(input().split())
print(values)
Thanks
In questa pagina del sito puoi guardare il video online Code 18: 2D Array Input in Python | Array Input Python | 365 days of code della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Code House 18 gennaio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 543 volte e gli è piaciuto 5 spettatori. Buona visione!