Python : Looping Statement Test 1

Q1. Write the output of the following

  • for i in "python":

    print (i)
  • for i in range(5):
        print(i)
  • for i in range(10,15):
        print(i)
Q2. Write a program to print first 10 natural number.

Q3. Write a program to print first 10 even numbers.

Q4. Write a program to print first 10 odd numbers.

Q5. Write a program to print first 10 even numbers in reverse order.

Q6. Write a program to print table of a number accepted from user.

Q7. Write a program to display sum of the digits of a number accepted from the user.

Q8. Write a program to find the factorial of a number.

Q9. Write a program to find the sum of the digits of a number.

Q10. Write a program to check whether a number is prime or not.
        

No comments:

Post a Comment

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet