Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 167 - 2632_CodeMind
P. 167

    b. def countX(lst, X):
                                   count = 0
                                   for ele in lst:
                                       if(ele==X):
                                           count = count + 1
                                   return count
                               lst = [5.24, 89, 5, 14, 5]
                               X = 5
                               result= countX(lst, X)
                               print(X, "has occurred", result ,"times.")

                          Let's exPLore                                                                 21 st
                                                                                                      Century   #Media Literacy
                                                                                                        Skills
                          Surf the Internet and explore about the List in Python.

                                SDG Activity

                         Design a simple computer network to track and monitor waste production and
                         recycling in your school. Create a program that collects data from different
                         classrooms, displays yearly wastage, and suggests ways to reduce it.

                          teCh PraCtiCe                                                        21 st   #Critical Thinking
                                                                                             Century
                                                                                               Skills  # Information Literacy
                          Write a program to:

                          1.    Count the total number of digits in the number 542892 and display it as output.
                          2.   Type your name in Python and make the first and the last letter of your name uppercase
                             and let the other letters remain lowercase.

                                                              For The Teacher

                             Demonstration of creating functions to the students.
                             Explain String in detail to the students.

                      166   Premium Edition-VIII

| 162 163 164 165 166 167 168 169 170 171 172 |