Wednesday, 17 December 2025

77 - Write a program in Python that repeatedly asks the user to input Student's Name and Class and store it in a dictionary D, whose keys are Student's Name and values are Student's Class. Then display the dictionary

Write a program in Python that repeatedly asks the user to input Student's Name and Class and store it in a dictionary D, whose keys are Student's Name and values are Student's Class. Then display the dictionary


D = {}

while True:

    name = input("Enter Student's Name: ")

    student_class = input("Enter Student's Class: ")


    D[name] = student_class


    choice = input("Do you want to add another student? (yes/no): ")

    if choice.lower() == "no":

        break

print("Student Dictionary:")

print(D)



Output:


Enter Student's Name: Amit

Enter Student's Class: 11

Do you want to add another student? (yes/no): yes

Enter Student's Name: Sumit

Enter Student's Class: 10

Do you want to add another student? (yes/no): yes

Enter Student's Name: Mohit

Enter Student's Class: 12

Do you want to add another student? (yes/no): yes

Enter Student's Name: Rohit

Enter Student's Class: 11

Do you want to add another student? (yes/no): no

Student Dictionary:

{'Amit': '11', 'Sumit': '10', 'Mohit': '12', 'Rohit': '11'} 

76 - Write a program in Python that takes a string as an input and displays it if its length is greater than 5.

Write a program in Python that takes a string as an input and displays it if its length is greater than 5.


# Take input from the user

text = input("Enter a string: ")


# Check length of the string

if len(text) > 5:

    print(text)

else:

    print("Length is not greater than 5")



Output:

Enter a string: Python
Python

OR

Enter a string: Ram
Length is not greater than 5

75 - Write a program in Python that takes a list of integer from the user and displays the number of even elements

Write a program in Python that takes a list of integer from the user and displays the number of even elements


# Take input from the user
numbers = eval(input("Enter a list of interger: "))

# Count even numbers
count = 0
for num in numbers:
    if num % 2 == 0:
        count += 1

# Display result
print("Number of even elements:", count)


Output:

Enter a list of interger: [5,2,9,4,8,7,3]
Number of even elements: 3

Sunday, 7 December 2025

International Computer Science Teachers Week (14–20 December 2025)

International Computer Science Teachers Week (14–20 December 2025)

Online Article, Essay, Poster & Banner Writing Competition


Dear Students,

As you know, 19 December is celebrated as International Computer Science Teachers Day, and this year, 14–20 December 2025 will be observed as International Computer Science Teachers Week. As part of the celebration of International Computer Science Teachers Week (14–20 December 2025), we are organizing an Online Article, Essay, Poster, and Banner Writing Competition.


๐ŸŽฏ Competition Categories


Article Writing – Topic related to Computer Science, Technology, AI, or Digital Innovation.


Essay Writing – 400–600 words on themes such as the role of CS teachers, impact of technology, future of computing, etc.


Digital Poster/Banner Making – Themes:


  • International Computer Science Teachers Week
  • Artificial Intelligence
  • Cyber Safety
  • Coding Culture
  • Digital Empowerment


๐Ÿ“… Important Details


Mode: Online Submission


Last Date for Registration: 12 December 2025


Submission Deadline: 18 December 2025


Result Announcement: 19 December 2025


๐Ÿ“Œ Registration


Students who wish to participate must register using the link below on or before 06 December 2025.

Registration Link: 


https://docs.google.com/forms/u/3/d/10zBu-8N6q0x2eVQwtUjz3zARbPcbbAns44C5RpUD0Ik/preview


We encourage all interested students to showcase their creativity, digital skills, and knowledge of Computer Science.

Let’s celebrate this week with innovation, inspiration, and enthusiasm!


All teachers are requested to kindly share this information in their respective schools as well.

Winners of the competition will be awarded prizes and certificates for their outstanding performance.


Students are requested to email their articles, essays, digital posters/banners, etc. to

support@spsharmag.com

 in any of the following formats: WORD / PDF / JPG / PNG before or on 18 Dec 2025


– Computer Science Department

Thursday, 18 September 2025

เค†เค‡เคฏे เคนเคฎ เคธ्เคตเคฏं เค•ो "Re-Routing" เคฎोเคก เคชเคฐ เคฐเค–ें

Life Lesson เค›ुเคชा เคนै Google Maps เคฎें, เคชเคข़िเค เคœ़เคฐूเคฐ ๐Ÿ‘‡

เคฐी-เคฐूเคŸिंเค— :
Re-Routing : 
เค•्เคฏा เค†เคชเคจे เค—ौเคฐ เค•िเคฏा เคนै เค•ि เค…เค—เคฐ เค†เคช เค—เคฒเคค เคฎोเคก़ เคฒेเคคे เคนै, เคคो Google เคฎाเคจเคšिเคค्เคฐ เค•เคญी เคญी เคšिเคฒ्เคฒाเคคा เคจเคนीं เคนै, เคจिंเคฆा เคฏा เค†เคชเค•ो เคกांเคŸเคคा เคจเคนीं เคนै।
เคฏเคน เค•เคญी เค…เคชเคจी เค†เคตाเคœ เคŠँเคšी เคจเคนीं เค•เคฐเคคा เค”เคฐ เคจ เคนी เคฏे เค•เคนเคคा เคนै, "เค†เคชเค•ो เค†เค–िเคฐी เค•्เคฐॉเคธिंเค— เคชเคฐ เคฌाเคं เคœाเคจा เคฅा, เคฌेเคตเค•ूเคซ! เค…เคฌ เค†เคชเค•ो เคฒंเคฌा เคฐाเคธ्เคคा เคคเคฏ เค•เคฐเคจा เคนोเค—ा เค”เคฐ เค‡เคธเคฎें เค†เคชเค•ो เคฌเคนुเคค เค…เคงिเค• เคธเคฎเคฏ เคฒเค—เคจे เคตाเคฒा เคนै เค”เคฐ เค†เคชเค•ो เคฆेเคฐ เคนोเคจे เคตाเคฒी เคนै
เคง्เคฏाเคจ เคฆें
"เค…เค—เคฐ เค‰เคธเคจे เคเคธा เค•िเคฏा, เคคो เคธंเคญाเคตเคจा เค•ाเคซी เคนै เค•ि เคนเคฎ เคฎें เคธे เคฌเคนुเคค เคธे เคฒोเค— เค‡เคธเค•ा เค‡เคธ्เคคेเคฎाเคฒ เค•เคฐเคจा เคฌंเคฆ เค•เคฐ เคธเค•เคคे เคนैं"
Google เค•ेเคตเคฒ "เคฐी-เคฐूเคŸ" เค•เคฐเคคा เคนै, เค”เคฐ เค†เคชเค•ो เคตเคนां เคชเคนुंเคšเคจे เค•ा เค…เค—เคฒा เคธเคฌเคธे เค…เคš्เค›ा เคคเคฐीเค•ा เคฆिเค–ाเคคा เคนै
เค‡เคธเค•ी เคช्เคฐाเคฅเคฎिเค• เคฐुเคšि เค†เคชเค•ो เค…เคชเคจे เคฒเค•्เคท्เคฏ เคคเค• เคชเคนुँเคšाเคจे เคฎें เคนै, เคจ เค•ि เค†เคชเค•ो เค—เคฒเคคी เค•เคฐเคจे เค•े เคฒिเค เคฌुเคฐा เคฎเคนเคธूเคธ เค•เคฐाเคจे เคฎें
เค‡เคธी เคฎें, เคฌเคนुเคค เคฌเคข़िเคฏा เคธเคฌเค• เคนै।
เค…เคชเคจी เคจिเคฐाเคถा เค”เคฐ เค•्เคฐोเคง เค•ो เค‰เคจ เคฒोเค—ों เคชเคฐ เค‰เคคाเคฐเคจा เค†เคธाเคจ เคนै, เคœिเคจ्เคนोंเคจे เค—เคฒเคคी เค•ी เคนै, เคตिเคถेเคท เคฐूเคช เคธे เค‰เคจ เคฒोเค—ों เคชเคฐ เคœो เคนเคฎाเคฐे เค•เคฐीเคฌी เค”เคฐ เคชเคฐिเคšिเคค เคนैं, เคฒेเค•िเคจ เคธเคฌเคธे เค…เคš्เค›ा เคตिเค•เคฒ्เคช เคธเคฎเคธ्เคฏा เค•ो เค ीเค• เค•เคฐเคจे เคฎें เคฎเคฆเคฆ เค•เคฐเคจा เคนै, เคฆोเคท เคฆेเคจा เคจเคนीं।
เค•्เคฏा เค†เคชเค•े เคชाเคธ เคนाเคฒ เคนी เคฎें เคฐी-เคฐूเคŸिंเค— เค•्เคทเคฃ เคฅे ?
เค”เคฐों เค•े เคธाเคฅ เคญी เค”เคฐ เค…เคชเคจों เค•े เคธाเคฅ เคญी ?
เค…เคชเคจे เคฌเคš्เคšों, เคœीเคตเคจเคธाเคฅी, เคŸीเคฎ เค•े เคธाเคฅी เค”เคฐ เค‰เคจ เคธเคญी เคฒोเค—ों เค•े เคฒिเค Google เคฎाเคจเคšिเคค्เคฐ เคฌเคจें, เคœो เค†เคชเค•े เคฒिเค เคฎाเคฏเคจे เคฐเค–เคคे เคนैं เค”เคฐ เคœिเคจเค•ी เค†เคชเค•ो เคชเคฐเคตाเคน เคนै।
เค†เค‡เคฏे เคนเคฎ เคธ्เคตเคฏं เค•ो "Re-Routing" เคฎोเคก เคชเคฐ เคฐเค–ें, เคœीเคตเคจ เค•ो เคธृเคœเคจाเคค्เคฎเค• เค”เคฐ เคธเค•ाเคฐाเคค्เคฎเค• เคฌเคจाเคฏे।
S P SHARMA SIR

#spsharmag๐Ÿ™

Wednesday, 9 April 2025

6. A school stores records of Class XII students using a list that contains multiple lists as its elements.

 A school stores records of Class XII students using a list that contains multiple lists as its elements. The structure of each such element is [Student_Name, Marks, MainSubject]. Crate user-defined functions to perform the operations as mentioned below:

(a) Push_student(): To push the Student_Name and Marks of all those students, who have Science as MainSubject, into a Stack StudentInfo
(b) Pop_student(): To delete all items (one at a time) from the stack StudentInfo in LIFO order and display them. Also display "Empty Stack" when there are no items remaining in the stack.
For Example:
If the stored information is:
[['Akansha',98,"Mathematics"],["Priti",96,"Science"],["Garima",99,"Science"],["Ayushi",78,"English"]]
The stack should contain:
[['Priti', 96], ['Garima', 99]]
The output should be:
["Garima",99]
["Priti",96]
Empty Stack

Solution:

def Push_student():
    for S in L:
        if S[2]=="Science":
            StudentInfo.append([S[0],S[1]])
    print(StudentInfo)
    
def Pop_student():
    while StudentInfo!=[]:
        print(StudentInfo.pop())
    else:
        print("Stack is Empty")

Push_student()
Pop_student()




8. Write a program in Python to input 5 words and push them one by one into a list named All.

  Write a program in Python to input 5 words and push them one by one into a list named All.

The program should then use the function PushNV() to create a stack of words in the list NoVowel so that it store only those words which do not have any vowel present in it, from the list All.
Thereafter, pop each word from the list NoVowel and display the popped word. When the stack is empty display the message 'EmptyStack'.
For Example:
If the words accepted and pushed into the list All are
['DRY','LIKE','RHYTHM','WORK','GYM']
Then the stack NoVowel should store
['DRY','RHYTHM','GYM']
And the output should be displayed as
GYM 
RHYTHM 
DRY 
EmptyStack


Solution:

Words=[]
for i in range(5):
    w=input("Enter any word: ")
    Words.append(w)

print(Words)
Stk=[]
V='aeiouAEIOU'

def  PushNV():
    for w in Words:
        c=0
        for v in V:
            if v in w:
                c=c+1
        if c==0:
            Stk.append(w)

def PopNV():
    while Stk!=[]:
        print(Stk.pop())
    else:
        print("Stack is Empty")


PushNV()
PopNV()

5. Priyanka has created a dictionary 'emeployee_data' containing EmpCode and Salary as key value pairs

 Priyanka has created a dictionary 'emeployee_data' containing EmpCode and Salary as key value pairs for 5 Employees of Cyber Intratech. Write a program, With separate user defined function, as mentioned below, to perform the following operations:

(a)  push_emp(): Push all those EmpCode, where the Salary is less than 25000, from the dictionary into a stack 'stk_emp'
(b)  pop_emp(): Remove all the elements from the stack, one at a time, in a Last-In-First-Out(LIFO) manner and displays them. It also displays 'Stack is empty' once all the element have been removed.
For Example:
If the sample content of the dictionary is as follows:
{'E001':15000,'E002':27000,'E003':30000,'E004':15000,'E005':19000}, then the stack 'stk_emp' will contain EmpCode E001, E004, E005 after push_emp(). pop_emp() will pop and display employee record in LIFO fashion and display 'Stack is empty' at last.

Solution:

stk_emp=[]
employee_data={'E001':15000,'E002':27000,'E003':30000,'E004':15000,'E005':19000}

def push_emp():
    for k in employee_data.keys():
        if employee_data[k]<25000:
            stk_emp.append(k)

def pop_emp():
    while stk_emp!=[]:
        print(stk_emp.pop())
    else:
        print("Stack is Empty")



push_emp()
pop_emp()

3. Write a program in Python, with separate user defined functions to perform the following operations on Stack 'City'.

Write a program in Python, with separate user defined functions to perform the following operations on Stack 'City'.

(a) - Push the pin code and name of the city in the stack 'City'
(b) - Display the latest added element in the stack 'City'


Solutions:


City=[]
data=[['Delhi',110001],['Sonipat',152364],['Khatauli',251201]]

def Push_City():
    for i in data:
        City.append(i)
    

def Display_City():
    L=len(City)
    print(City[L-1])

Push_City()
Display_City()

2. A School has created a dictionary containing top players and their runs as key value pairs of cricket team.

 A School has created a dictionary containing top players and their runs as key value pairs of cricket team. Write a program with separate user defined functions to perform the following operations:

(a)    Push the name of the players(Keys) of the dictionary into a stack, where the corresponding runs (value) is greater than 49.
(b)    Pop and display the content of the stack.
For Example
If dictionary has the following values:
Data={'Rohan':40, 'Rihaan':55, 'Tejas':80,'Ajay':90}
The output should be:
Ajay
Tejas
Rihaan


Solutions

S=[]
Data={'Rohan':40, 'Rihaan':55, 'Tejas':80,'Ajay':90}
def Push_Player():
    for k in Data.keys():
        if Data[k]>49:
            S.append(k)

def Pop_Player():
    while S!=[]:
        print(S.pop())
    else:
        print("Stack is Empty")



Push_Player()
Pop_Player()