Posts

Library Management System

import os from datetime import datetime  from rapidfuzz.fuzz import partial_ratio def search(text, books, threshold=80):     matches = [         book for book in books         if partial_ratio(text.lower(), book.lower()) >= threshold     ]     return len(matches) > 0, matches books = [     "The 7 Habits of Highly Effective People - Stephen R. Covey",     "How to Win Friends and Influence People - Dale Carnegie",     "Atomic Habits - James Clear",     "Think and Grow Rich - Napoleon Hill",     "The Power of Now - Eckhart Tolle",     "Awaken the Giant Within - Tony Robbins",     "The Subtle Art of Not Giving a F*ck - Mark Manson",     "The Four Agreements - Don Miguel Ruiz",     "The Power of Positive Thinking - Norman Vincent Peale",     "You Are a Badass - Jen Sincero",     "Mindset: The New Psychol...

Snake Water and Gun Game

Image
  print("Welcome to Snake Water Gun Game") print("Enter your choice") print("s=Snake") print("w=Water") print("g=Gun") def converttxt2num():   player1 = (input("Enter your choice player1: "))   if player1 == 's':  return 1   elif player1 == 'w': return 2   elif player1 == 'g': return 3   else:     print("Invalid choice")     return None player1 = converttxt2num() if player1==1:   print("You chose Snake") elif player1==2:   print("You chose Water") elif player1==3:   print("You chose Gun") else:   print("Invalid choice") def converttxt2num2():   player2 = (input("Enter your choice player2: "))   if player2 == 's':  return 1   elif player2 == 'w': return 2   elif player2 == 'g': return 3   else:     print("Invalid choice")     return None player2 = converttxt2num2() if player2==1:   print("You chose Snake...

Secret Code Language

Image
  import random st = input("Enter message") words = st.split(" ") coding = input("1 for Coding or 0 for Decoding") coding = True if (coding=="1") else False print(coding) if(coding):   nwords = []   for word in words:     if(len(word)>=3):       r1 = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range(3))       r2 = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range(3))       stnew = r1+ word[1:] + word[0] + r2       nwords.append(stnew)     else:       nwords.append(word[::-1])   print(" ".join(nwords)) else:   nwords = []   for word in words:     if(len(word)>=3):        stnew = word[3:-3]       stnew = stnew[-1] + stnew[:-1]       nwords.append(stnew)     else:       nwords.append(word[::-1])   print(" ".join(nwords))

kaun Banega Crorepati KBC

Image
 questions = [   'In which year constantinople was conquered? ',   ' \nWhat is the capital of Turkey? ',   '\nIn Which century was The Great Ottoman Empire Formed',   "\nUnder which Sultan's rule The Ottoman Empire saw its greatest extent  ",   '\nWho was the accursed person under whom islam was diminished in turkey '  ] for x in questions:   print(questions[0])    a = input('answer: ')   if a == '1453':     print('\n!!**adbhood**!!')     print( questions[1])     b = input('answer: ')   if a != '1453':     print('mahashai aap haar chuke hain')     break   if b == 'ankara' :     print('\n !!**adbhood**!!')     print(questions[2])     c = input('answer: ')   else :     print('mahashai aap haar chuke hain')     break        if c == '13' :     print('\n !!**adbhood**!!')     prin...