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

  • AWS Interview Q&A for Beginners (Must Watch!)

    AWS Interview Q&A for Beginners (Must Watch!)

    The content outlines essential AWS basics interview questions that every beginner should be familiar with. It serves as a resource for fresh candidates preparing for interviews in cloud computing. The link provided leads to additional multimedia content related to the topic.

  • How a PySpark Job Executes: Understanding Statements, Stages, and Tasks

    How a PySpark Job Executes: Understanding Statements, Stages, and Tasks

    When you write a few lines of PySpark code, Spark executes a complex distributed workflow behind the scenes. Many data engineers know how to write PySpark, but fewer truly understand how statements become stages, stages become tasks, and tasks run on partitions. This blog demystifies the internal execution model of Spark by connecting these four…

  • Azure Data Factory (ADF): The Complete Beginner-Friendly Guide (2026 Edition)

    Azure Data Factory (ADF): The Complete Beginner-Friendly Guide (2026 Edition)

    Azure Data Factory (ADF) is Microsoft’s fully managed, cloud-based data integration and orchestration service. It helps you collect data from different sources, transform it at scale, and load it into your preferred analytics or storage systems. Whether you are working with Azure SQL, on-premises databases, SaaS applications, or big-data systems, ADF gives you a unified…