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 Glue Crawler Issue with Dynamic S3 Folder Paths? Here’s the Complete Fix

    AWS Glue Crawler Issue with Dynamic S3 Folder Paths? Here’s the Complete Fix

    Learn how to fix AWS Glue crawler issues when S3 paths contain dynamically changing folders like hash values or UUIDs. Step-by-step beginner-friendly guide.

  • How to Create a Generic Stored Procedure for KPI Calculation (SQL + AWS Lambda)

    How to Create a Generic Stored Procedure for KPI Calculation (SQL + AWS Lambda)

    In modern data engineering, building scalable and reusable systems is essential. Writing separate SQL queries for every KPI quickly becomes messy and hard to maintain. A better approach?👉 Use a Generic Stored Procedure powered by Dynamic SQL, and trigger it using AWS Lambda. In this blog, you’ll learn: What is a Generic Stored Procedure? A…

  • Unlocking the Power of Databricks Genie: A Comprehensive Guide

    Unlocking the Power of Databricks Genie: A Comprehensive Guide

    Databricks Genie is a collaborative data engineering tool built on the Databricks Unified Analytics Platform, enhancing data analytics for businesses. Key features include collaborative workspaces, efficient data processing with Apache Spark, built-in machine learning capabilities, robust data visualization, seamless integration, and strong security measures, fostering informed decision-making.