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
-
From Laptop to Cloud: Deploy Your First Production DB Using Amazon RDS
Learn how to move from a local database to a production-ready cloud setup using Amazon RDS. A beginner-friendly step-by-step guide covering setup, backups, scaling, and best practices.
-
The End-to-End AI Stack – A Real Guide for Developers to Code, Create, and Execute
Learn how modern AI tools like ChatGPT, NotebookLM, and Antigravity fit into the AI stack. Discover the 5-layer AI capability model and how to choose the right AI tools for thinking, creating, building, and automat
-
FAANG-Style SQL Interview Traps (And How to Avoid Them)
SQL interviews at FAANG (Facebook/Meta, Amazon, Apple, Netflix, Google) are not about syntax. They are designed to test logical thinking, edge cases, execution order, and data correctness at scale. Many strong candidates fail—not because they don’t know SQL, but because they fall into subtle traps. In this blog, we’ll walk through real FAANG-style SQL traps,…






