Page 151 - TP_Prime_V2.2_Class8
P. 151

d.  start = 1
                        end = 10

                        for number in range(start, end + 1):
                        square = number ** 2

                        print("The square of", number, "is", square)

                     e.  numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                        for number in numbers:

                        if number % 2 == 0:
                        print(number, "is even")                                                                            LOOPS IN PYTHON

                        else:
                        print(number, "is odd")


                    Find Out                                                                        Century   #Media Literacy
                                                                                                      21 st
                                                                                                      Skills              149
                 Surf the Internet and explore why Python is more famous than the other languages.





                           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.









                                                                                                21 st
                            In the Lab                                                       Century   #Technology Literacy
                                                                                               Skills

                    Write a program to:
                    1.   print the table of 17 and stop before it reaches a three digit number.

                    2.  input a number from the user and print if the number is between 30 – 50 range.
                    3. use while loop to print squares of a user input value 10 times.

                    4. print all odd numbers between 10 and 30.
   146   147   148   149   150   151   152   153   154   155   156