Page 336 - Informatics_Practices_Fliipbook_Class12
P. 336

17.   Consider  the  following  list  representing  the  daily  customer  count  for  a  restaurant  over  a  month:
              [50, 55, 60, 70, 75, 80, 85, 90, 95, 100, 110, 115, 120, 125, 130, 135,
              140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 180].
              Write a Python program using matplotlib to create a line plot to visualize the daily customer trends. Represent
              the data with a green dashed line style and provide appropriate labels for the axes and title for the Figure. The
              Figure should comprise gridlines and should be saved as "customerTrends.png."
         18.   Consider the following list representing the annual population growth (in thousands) of a city over the last
              decade:
              populationGrowth = [21770, 21895, 21966, 22118, 22336, 22661, 22964, 23213,

              23434, 23689]
               Write a Python program using matplotlib to create a line plot blue dashed line with circular markers. Provide
              appropriate labels for the axes and a title for the Figure. Save the plot as "populationGrowth.png."
         19.   Consider  the  following  data  comprising  library  membership  duration  (in  years)  and  the  number  of  books
              borrowed:

              libraryMembershipDuration = [3, 2, 5, 1, 4, 6, 2, 7, 3, 4]
              numBooksBorrowed = [10, 5, 15, 2, 12, 18, 6, 20, 8, 11]
               Write a Python program to create a scatter plot with green triangles as markers. Label the axes and provide a
              title. Save the figure as "membershipBorrowingCorrelation.png."
         20.   Consider the following data comprising restaurant ratings (on the scale 1 to 5) and the number of reviews for five
              restaurants:

              restaurantRatings = [4.2, 4.5, 3.9, 4.7, 4.1]
              numReviews = [120, 250, 80, 310, 95]
               Write a Python program to create a scatter plot with purple crosses as markers. Label the axes and provide a title.
              Save the figure as "ratingReviewCorrelation.png."

         21.   Consider the following dataset comprising number of viewers watching different genres of content in the past
              month:

              genres = ["Action", "Comedy", "Drama", "Documentary", "Science Fiction", "Horror"]
              viewerCounts = [45000, 55000, 60000, 30000, 35000, 40000]
               Write a Python program to create a bar graph that compares the viewership of various genres using distinct
              colours. Label the axes and provide a title. Save the figure as "viewership.png."

         22.  Health authorities have collected data on the body mass index (BMI) of individuals in a specific region:
              bmiData = [24.3, 29.1, 22.0, 26.7, 25.8, 27.5, 31.2, 23.9, 28.4, 30.5, 25.1,
              27.0, 29.8, 23.7, 26.5, 28.2, 22.9, 27.4, 30.0, 26.6, 25.2, 24.6, 31.8, 28.9,
              25.4, 29.7, 23.2, 26.3, 27.8, 30.3]
               Write a Python program using matplotlib to create a histogram to visualize the the BMI distribution. Label the
              axes and provide a title for the figure. Save the figure as "BMIdistribution.png."
         23.   Write a program to accept a positive integer (n) and a floating point number (x) print sum of following series:

                        2
                                  3
              x/1! - x /2! + x /3! - ...
              The program should keep adding the terms until the absolute value of a term becomes less than 0.001.
         24.  Write a program to accept a number (say, n) and print n terms the following sequence of numbers:
              1, 2, 4 , 7, 11, 16, 22   ( if the value of n is 7)
         25.  Write a program to display the sum of squares of each digit of a given number.



          322  Touchpad Informatics Practices-XII
   331   332   333   334   335   336   337   338   339   340   341