Page 430 - Ai_417_V3.0_C9_Flipbook
P. 430

6.  What are comments in Python? List down the various types of comments.             [CBSE Handbook]
                  7.  Explain the three different numeric data types available in Python.
                  8.  Explain different types of errors in Python.
                  9.  What is type conversion? Explain the types of type conversion with the help of an example.   [CBSE Handbook]

                 10.  Differentiate between the for loop and the while loop.
                 11.  List the important rules to remember when using the range() function in the for loop.
                 12.  Name different ways of deleting an element in a list.
                 13.  What is the use of the * operator in a list?

                 14.  Explain two different ways of indexing in a list.

              C.  Write Python code for the given instructions.
                  1.  Input three angles and check whether they form a triangle or not.
                  2.  Input time in seconds and change it into minutes.
                  3.  Find the result of 22/7 * 5 * 5 i.e. the area of a circle having a radius of 5.   [CBSE Handbook]
                  4.  Input length and breadth and display whether it is a square or not.
                  5.  Input a number between 1 and 7 and display the weekday based on the number entered.
                  6.  Take a Boolean value “False” and a float number “15.6” and perform the AND operation on both.   [CBSE Handbook]

                  7.  Input Salary and Years of Service. If the number of years is more than 5 then give an extra bonus of 15%. Display the
                    net salary after adding the bonus.
                  8.  Take a string “Zero” and a Boolean value “True” and try adding both by using the Bool () function.  [CBSE Handbook]
                  9.  Input the billing amount of shopping done. If the amount is more than 5000 then give a discount of 10%. Display the
                    net billing amount after the discount.
                 10.  Take a Boolean value and add a string to it.                                      [CBSE Handbook]
                 11.  Take a string “Morning “and the float value “90.4” and try and add both of them by using the float () function.
                                                                                                        [CBSE Handbook]



                                                                            #Computational Thinking
                                Lab


                        1.   Write an algorithm for calculating the Net salary of a person (Net Salary=Basic + Allowances – Deductions).
                           Take the Basic, Allowances and Deductions as input.
                        2.   Write an algorithm to print the larger of the two marks taken an input. Also, draw a flowchart.

                        3  Write a Python program to:
                           a.  Convert Celsius to Fahrenheit using the formula: (Celsius * 1.8) + 32
                           b.  Input five names from the user and print them in the same line with a single space.
                           c.  Swap the values of two variables using the third variable.

                           d.  Convert kilometre unit to metre.
                           e.  Calculate the area of a square.
                           f.  Interchange the values of the adjacent elements of the list. Print the updated list.
                           g.   Input five names of cities in a list. Accept a name and check whether it exists in a list or not. Display
                              an appropriate message.



                    428     Touchpad Artificial Intelligence (Ver. 3.0)-IX
   425   426   427   428   429   430   431   432   433   434   435