Answer to Question #304971 in Python for sruthi

Question #304971

Create and Print List -3:

You are given N numbers as input. Create a list and add the N numbers which are given as input and print the list.


Input:

The first line of input is an integer N. The next N lines each contain an integer.

Explanation:

In the given example,

N=4 and the numbers are 1, 2, 3, 4. So, the output should be [ 1, 2, 3, 4 ]

Sample Input 1

4

1

2

3

4

Sample Output 1

[1, 2, 3, 4]

Sample Input 2

3

13

21

19

Sample Output 2

[13, 21, 19]


can i get code without using append


1
Expert's answer
2022-03-02T08:20:02-0500
Count = int(input("Enter Count: "))
nums = list(map(int,input("\nEnter the numbers : ").strip().split()))[:Count]
print("\nNumbsers are - ", nums)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS