Here is a Python program that prints N numbers. It asks input from the user how many numbers to print. The user input is used in the if condition to print the numbers.
Here is sample Python program
nums= []
# number of elements as input
n = int(input("Enter number of elements : "))
# iterating till the range
for i in range(0, n):
ele = int(input("Enter number:"))
nums.append(ele) # adding the element
print(nums)
Also read: 12 Tricky Python Coding Interview Questions
The result of the program
Enter number of elements :
5
Enter number:
1
Enter number:
2
Enter number:
3
Enter number:
4
Enter number:
5
[1, 2, 3, 4, 5]
** Process exited - Return Code: 0 **
Press Enter to exit terminal
Related posts
-
Linking Words Practice: Improve Your English Speaking Fluency Naturally
Learn how to use linking words in English speaking with practical examples. Improve your fluency, communication skills, and confidence using transition words for conversations, presentations, and interviews.
-
Databricks DLT with @dp: A Complete Guide to Streaming and Batch Processing
Learn how to use Databricks Lakeflow Declarative Pipelines with @dp for streaming tables and materialized views. Includes architecture, examples, and deployment steps.
-
AI Agents for Beginners: Everything You Need to Know
Learn what AI agents are, how they work, their benefits, use cases, frameworks, and future trends in this complete beginner-friendly guide.






