Skip to main content

Posts

Showing posts from October, 2024

GRADE XI - PYTHON - TUPLE

  GRADE XI   PYTHON - TUPLE A tuple is a sequence data type of Python that are used to store objects of different data types in a given order. #Creating a tuple through input() and tuple( ) method t1 = tuple(input("value -")) print(t1) >>>value -1234 #Creating tuple by accepting data from user using Looping statements When data are accepted from user into a tuple using while loop, the entered data is concatenated in the tuple using + (concatenation) operator. Example: Accepting n elements from user into a tuple using while loop T1 = () #Empty tuple n = int(input("Enter number of elements")) i= 0 while i< n:     num=eval(input("Enter the elements -"))     T1+= (num,) # T1+= num,      i+=1 print(T1) Accepting n elements from user into a tuple using for loop T1 = () #Empty Tuple n = int(input("Enter number of elements")) for i in range(n):     T1+= eval(input("elements")), print(T1) Tuple object with single element To ...

GRADE XII - MYSQL PRACTICE QUESTIONS

 GRADE XII  MYSQL PRACTICE QUESTIONS 1. For the following table answer the following questions RTNO | AREA_COVERED | NO_OF_STUD | DISTANCE | TRANSPORTER | CHARGES 1                Rajiv Chowk                50                          10                       Anand Travel        10000 2                Old GGn                        54                          20                       Bhalla Co.              20000     Que 1 .  For the following table answer the following questions a. ...

GRADE XI - STRING PRACTICE QUESTIONS - 21 OCT 24

  PYTHON STRINGS PRACTICE QUESTIONS 1. FIND THE OUTPUT x = "hello world" print (x[:2], x[:-2], x[-2:]) print (x[6], x[2:4]) print (x[2:-3], x[-4:-2]) 2. x = "hello" + "Python"  for chr in x :     y = chr     print (y, ":", end = ' ') 3. str = "Mississippi" for i in range (len (str)) :     if str[ i ] == 'i' :         print (i) 4. st="LoTusValLey is my school" ns="" for i in range(1,len(st)//2):     if st[i].isupper():         ns=ns+st[i].lower()     else:         ns = ns+st[i].upper() print(ns)   5. input='LotuSValLey' output="" for i in input:     ans=ord(i)     if ans>=65 and ans<=90:         output+=chr(ans+32)     else:         output+=chr(ans-32) print(input + ' after changing ' + output) 6. s = '0123456789' print(s[3]) print (s[3], s[0:3], '-', s [2:5]) print (s[:3], '-', s[3:],...

GRADE XI - PYTHON STRINGS WITH PDF NOTES

  GRADE XI   PYTHON STRINGS Practice Questions            PPT LINK : PPT LINK 1. #Code to check number of words starting with Vowel (Without in-built function) string = input("Enter a string: ")   length = len(string)   ctr = 0   i = 0  # Pointer to traverse the string while i < length:     # Skip any extra spaces     while i < length and string[i] == " ":         i += 1     # check if it starts with a vowel     if i < length and string[i] in "aeiouAEIOU":         ctr += 1     # Move the pointer to the end of the current word     while i < length and string[i] != " ":         i += 1 print("Number of words starting with a vowel:", ctr) With Split Function: string = input("Enter a string: ")   words = string.split()   print("Words:", words) ch = 0 ...