Question
Following is the script to display first n natural numbers, where n is input from the user. If the user enters 0 or a negative number, the code generates no output.

Answer

n = eval(input("Enter a number: "))
for i in range(1,n+1):

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free