About 3,960,000 results
Open links in new tab
  1. Get a list as input from user in Python - GeeksforGeeks

    Dec 5, 2024 · In this article, we will see how to take a list as input from the user using Python. The input() function can be combined with split() to accept multiple elements in a single line and …

  2. Python Accept List as a input From User - PYnative

    Sep 8, 2023 · Use an input() function to accept the list elements from a user in the format of a string separated by space. Use the split() function of the string class. Next, the split() method …

  3. A list with n values in Python - Stack Overflow

    Feb 24, 2021 · listOutput = []; InputNumber = 15 for n in range(1, InputNumber+1): listOutput.append('AB'+ str(n)) print(listOutput)

  4. To accept N numbers from user. Compute and display maximum in list

    Jun 22, 2023 · #enter total numbers from 0 to N-1 for i in range(0,N): num=int(input(“enter number: “)) Num_list.append(num) #calculating maximum and minimum number …

  5. How to get N inputs from user in python - Stack Overflow

    Jun 11, 2015 · You can accept their input and convert it to an int >>> size = int(input('Enter size of array: ')) Enter size of array: 3 Then use this value within the range function to iterate that …

  6. How to Get First N Items from a List in Python - GeeksforGeeks

    Apr 8, 2025 · Accessing elements in a list has many types and variations. This article discusses ways to fetch the first N elements of the list. This problem can be performed in 1 line rather …

  7. 5 Best Ways to Get a List as Input from User in Python

    Mar 11, 2024 · prompt = "Enter items for the list one per line, press enter on an empty line to finish.\n" lines = [] while True: line = input(prompt) if line: lines.append(line) else: break …

  8. How to take n number of inputs in Python | Example code

    Dec 24, 2021 · Use map() function and split() function to take n number of inputs in Python. list(map(int, input().split()[:N])) input(): takes user input. split(): Splitting the string into a …

  9. How to Take List Input in PythonPython List Input - Intellipaat

    Oct 1, 2024 · Various Ways to Take List Input in Python. Handling list inputs is a common task in Python programming, and there are various methods to do so. Let us see five different …

  10. The Ultimate Guide to Accepting List Inputs in Python

    Whether it’s a list of numbers or strings, a nested list, or a list of values within a specific range, Python provides several ways to accept list inputs from users. In this guide, we explored …

Refresh