PYTHON ASSIGNMENT 1 - CONTROL STRUCTURES


If – elif – else structure


Check if given number is greater than 5

Check if given number is odd or even

Check if a given number is positive, negative or zero

Check for leap year

Biggest / smallest of three numbers

Check if given number is a single, two, three or four digit number.

Check if given character is vowel or not

Read a customer name, number of items purchased and price of item. If gross amount is greater than 500, a discount of 10 % is applicable. Find the net amount to be paid by the customer.


While loop


Print numbers from 1 to 5

Read and display 5 numbers

Print numbers between two limits and type (odd / even)

Read and display 5 numbers.
     Find
          Sum of 5 numbers
          Mean of 5 numbers
          Biggest of 5 numbers
          Smallest of 5 numbers

Factorial of a given number

Fibonacci series

Number manipulation. Given a number
     Find
          Count number of digits in a given number
          Sum of digits in a given number
          Reverse of the number

Armstrong number (Sum of cubes of individual digits in a given number equal to original number)

Check if given number is a Prime number or not

Display all the prime numbers between two limits


For loop


Print numbers from 1 to 5

Read and display 5 numbers

Print numbers between two limits and type (odd / even)

Read and display 5 numbers.
     Find
          Sum of 5 numbers
          Mean of 5 numbers
          Biggest of 5 numbers
          Smallest of 5 numbers

Factorial of a given number

Fibonacci series

Number manipulation. Given a number
     Find
          Count number of digits in a given number
          Sum of digits in a given number
          Reverse of the number

Armstrong number (Sum of cubes of individual digits in a given number equal to original number)

Check if given number is a Prime number or not

Display all the prime numbers between two limits





No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu