“Jak uzyskać dane użytkownika listy list w Python” Kod odpowiedzi

Uzyskaj dane wejściowe listy od użytkownika w Python

a = list(map(int,input("\nEnter the numbers : ").strip().split()))
Faithful Flamingo

Jak uzyskać dane wejściowe użytkownika w Python

# number of elements 
n = int(input("Enter number of elements : ")) 
  
# Below line read inputs from user using map() function  
a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n] 
  
print("\nList is - ", a)
Bright Butterfly

Jak uzyskać dane użytkownika listy list w Python

lst = [ ] 
n = int(input("Enter number of elements : ")) 
  
for i in range(0, n): 
    ele = [input(), int(input())] 
    lst.append(ele) 
      
print(lst)
Bright Butterfly

Odpowiedzi podobne do “Jak uzyskać dane użytkownika listy list w Python”

Pytania podobne do “Jak uzyskać dane użytkownika listy list w Python”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu