Skip to main content

REVISION LIST PRACTICE - 21 AUG

 

REVISION LIST PRACTICE 

GRADE XI


1.#LINEAR SEARCH/search for an element in a given list

list1=eval(input("Enter the List elements"))

length=len(list1)

element=int(input("Enter the element to be searched for")) 

for i in range(0,length):

    if element==list1[i]:

        print("Element found At Index:",i)

        break

else:

    print(element,"Not present in the list")


2.#[45,66,20,77,20]

#REPLACE [ALL 2 WITH 20 IN A LIST]

a=[1,2,2,1,4,5,1]

for i in range(len(a)):

    if a[i]==2:

        a[i]=20

print(a)


3. #PROGRAM TO CALCULATE MEAN OF A GIVEN LIST NUMBERS

list1=eval(input("Enter the List elements"))

length=len(list1)

mean=sum=0

for i in range(0,length):

    sum+=list1[i]

mean=sum/length

print("Given List is:",list1)

print("Mean of Given List is:",mean)


4.#ADDITION OF ELEMENTS

list1=[4,5,6,6]

list2=[1,2,3,4]

print("ORIGINAL LIST1 IS:"+str(list1))

print("ORIGINAL LIST2 IS:",list2)

res_list=[]

for i in range(0, len(list1)):

    res_list.append(list1[i]+list2[i])

print("The resultant List is :"+str(res_list))


5#Program to input a list and to count number of #non-numeric data in a list

list=[]

s = int(input("Enter no of elements - "))  

for i in range(s):

    list+=[eval(input("Enter the element - "))]  

print(list)

ctr=0

for i in range(s):

    if type(list[i])==str:

           ctr+=1

print("no. of non-numeric data - ",ctr)


6#Find Max number in a given list

list=[1,20,30,87,34]

max = list[0]

for a in list:

    if a > max:    

        max = a

    print(max)

Comments

Popular posts from this blog

GRADE XII - Python Connectivity with MySQL

  Python Connectivity with MySQL In real-life applications, the data inputted by the user and processed by the application needs to be saved permanently, so that it can be used for future manipulation. Usually, input and output data is displayed during execution but not stored, as it resides in main memory , which is temporary — i.e., it gets erased once the application is closed. This limitation can be overcome by sending the data to be stored in a database , which is made accessible to the user through a Front-End interface . Key Concepts Database A database is an organized collection of data that is stored and accessed electronically from a computer system. DBMS (Database Management System) A DBMS is software that interacts with end-users, applications, and the database to capture and analyze data. Front-End The Front-End is the user interface of the application, responsible for input/output interaction with the user. Back-End The Back-End refe...

GRADE XI | DESIGN THINKING & INNOVATION (848) | INTRO | CH-1

  DESIGN THINKING &  INNOVATION (848)  INTRODUCTION LINK : INTRODUCTION PPT PPT LINK Notes: Design Thinking and Innovation Grade XI Introduction Section   I. What is Design? (0.1.1) Definitions from Experts: John Maeda: "Design is solution to a problem". Saul Bass: "Design is thinking made visual". Charles Eames:   “Design is a plan for arranging elements in such a way as best to accomplish a particular purpose.” Steve Jobs:  "Design is not just what it looks like and feels like. Design is how it works". Prof. Sudhakar Nadkarni:  "Essentials of design are— purity, precision, details". Design is a way of understanding needs, identifying problems, and creating appropriate and innovative solutions. It is not only about appearance, but also about usefulness and sustainability. Design is explained as something that helps solve problems and make a positive difference. Key ...