Python practice section 1

To learn coding, most important thing is to code. No one can learn coding by watching videos and reading articles. In this article, you will do questions based on 'if else', 'loops', 'break', and continue in Python.
Solve the following questions yourself to master these concepts:
  1. Take a number from the user and print whether this number is positive or negative.

  2. Take a number from the user and show it is even or odd.

  3. Take age from the user as input and print 'you can vote' if age is greater than 18 years, otherwise, print 'You need to go park and play'.

  4. Create a simple calculator:- Take 2 numbers from the user and the operator as input and perform the operation on numbers based on the operator given by the user.

  5. Take a number from the user and print its table.

  6. Write a program to print the following pattern using loop. Ask the user to enter number of rows.
      *
      * *
      * * *
      * * * *
      * * * * *
    

  7. Write a program to print the following pattern using loop. Ask the user to enter number of rows.
      * * * * *
      * * * *
      * * *
      * *
      *
    

  8. Write a program to print the following pattern using loop. Ask the user to enter number of rows.
               *
             * *
           * * *
         * * * *
       * * * * *
    

  9. Write a program to print the following pattern using loop. Ask the user to enter number of rows.
               *
             * * *
           * * * * *
         * * * * * * *
       * * * * * * * * *
    

  10. Write a program to find sum of the following series:
    1 + 2 + 3 + 4 + ........ up to N terms.
                        

  11. Write a program to find sum of the following series:
    1 + x + x2 + x3 + x4 + ........ up to N terms.
                        

  12. Write a program to print first n Fibonacci numbers.