Python - Conditional Statement Test 1

 Q1. Name the keyword which helps in writing code involves condition.

Q2. Write the syntax of simple if statement.

Q3. Is there any limit of statement that can appear under an if block.

Q4. Write a program to check whether a person is eligible for voting or not. (accept age from user)

Q5. Write a program to check whether a number entered by user is even or odd.

Q6. Write a program to check whether a number is divisible by 7 or not.

Q7. Write a program to display "Hello" if a number entered by user is a multiple of fie , otherwise print "Bye".

Q8. Write a program to calculate the electricity bill according to the following criteria :

                    unit                                price

                    First 100 units -----------no charge

                    Next 100 units ----------Rs 5 / unit

                    Next units ---------------Rs 10/unit

(For example if input unit is 350 than total bill amount is Rs2000)

Q9. Write a program to display the last digit of a number.

(hint : any number % 10 will retun the last digit)

Q10. Write a program to check whether the last digit of a number( entered by user ) is divisible by 3 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