Posts

i missed my practicals pt.2

Image
Works on pygame. Install pygame using cmd:       pip install pygame Download and run the code. This is an application of Biot-Savarts law on each side using the result-                          B = μo NI(sinA + sinB)/ 4Ï€D      (direction is in/out of the plane) Code finds cursor's position on the Cartesian plane and calculates the value of A, B and D accordingly from each side of polygon. I have also converted the screen point system into cartesian system such that the center of the window now behaves as origin (0,0). Each side is 100 units and positions of vertex are found by taking parametric positions of circumcircle of the polygon (parameter being multiple of central angle (360/n)).                        circum radius = a/sqrt(2-2cosA)                     : a = side length and A = 360/n                     : n = no of sides. (Yes i derived this, i wasted so many goddammed hours on it, i should have just googled it, though it was a good mental exercise, got a revision of geo

tictactoe gui

Image
ONLY ONE WAY TO DEFEAT IT, IF I WANT I CAN MAKE IT FULL PROOF, BUT JUST LIKE OLD LADY SAINT MISS SUJATA ONCE SAID-  "Draw hi bas hoga to maza kya". 1. Download the file . 2. Extract all. 3. Run ultimate.py . If you find the loophole, mail me at diptanshu.1406@gmail.com, I will send you 50 rupees. Don't waste your time on recreating useless games. dm

I FINALLY MADE IT! (tic tac toe)

Image
I finally made single player tic tac toe.  If you are really lonely computer will play with you. I always wanted to make this, ever since I started python, today its done. mera bachpan ab pura hogya (I will be 18 in 3 months). Its simple text based version. Putting it on GUI would be annoying, will probably do it sometime later using pygame, as the basic logic behind it is ready and done. The code isn't optimized so well, because I was so happy it worked consequently I stopped putting efforts on it. Just download it, and run the code . dm

#4ab: Coding in Python {Roman-Decimal [GUI]}

Image
This simple code converts Roman Numerical into Decimals and vice versa real-time. Graphics User Interface, use cursor to switch between the modes. No additional libraries are required, simply download the file and run it. Chat GPT for GUI part, i keep forgetting how to use tkinter. Special thanks to Miss Sujata for giving me the idea for this project. dm

i missed my practicals pt.1

Image
Works on pygame. Simply install pygame using cmd:      pip install pygame And run the code . Works on simple principle of drawing ray diagrams. First ray passes from optical center and the second ray passes from the focus. Image is drawn by drawing perpendicular to the x axis from the point of intersection. Dotted ray or image shows its virtual nature. Intersection points are found using basics mathematics and concepts from straight lines. Initial the code run and draws the graph of U vs V and then it is available for simulation. The rectangular hyperbola is the graph of U vs V.  A line drawn at 45 degrees from origin in the 2nd quadrant cuts the graph at 2f, 2f. This is used to determine the focal length of the given lens. Thanks to - My physics teacher, lab assistant, friends (Ayush, Ashwini) who helped in the experiment. (And yes, i didn't miss my practicals) dm

SMART PEOPLE WON'T USE IT: SPOTIFY PLAYLIST TO MP3.

Image
STEP 1: open cmd and type pip install selenium after installation of selenium pip install spotipy (make sure set PATH was checked while installing python, else pip won't work)   STEP 2: download geckodriver.  https://github.com/mozilla/geckodriver/releases extract it   STEP 3: open cmd and type setx path "%path%;<GeckoDriver Path>" example: setx path "%path%;C:\Users\hp\Desktop\DownloadSpreeDec2022\i created balls\geckodriver.exe>" (you can find path by righting clicking on 'geckodriver.exe' then choosing copy as path)   STEP 4: Download this code and run it- file   STEP 5: Copy spotify playlist which you want to download and paste it. Press enter and wait. Songs will be downloaded in a moment. If you face any problems, mail me at- diptanshu.1406@gmail.com   This is pirating songs from piracy websites. Its illegal to do so. Don't do it- just buy Spotify premium. I created this because I wan

#4aa: Coding in Python {LCM Calculator}

Image
x=1 while x!=0:     howMany = int(input('Enter number of numbers: '))     print()     if howMany>1:         x=0         allNumbers = []         for i in range(howMany):             EN=('Enter number #{}: '.format(i+1))             y=1             while y!=0:                                 number = int(input(EN))                 if number>1:                     y=0                     allNumbers.append(number)                 else:                     print('Retry, make sure that desired number is a natural number, i.e., more than 0.')                     print()         #product         product = 1         for i in (allNumbers):                 product=product*i         #collection            bigList=[]         for i in (allNumbers):             for j in range (1,(int(product/i))+1):                 bigList.append(i*j)               #filter         for i in (bigList):             if bigList.count(i)==howMany:                  print()                 print

#4z: Coding in Python {Sorter}

Image
 116 times better than this garbage  . n = int(input('No of terms: ')) itema = [] for i in range(n):     t = int(input("Enter numbers: "))     itema.append(t)     def ran(di):     global want     low = di[0]         for i in (di):         if i<low:low=i       return low test1 = [] for i in range (n):     test1.append(ran(itema))     itema.remove(ran(itema)) print(test1) test1.reverse() print(test1) I would like to thank Mr. Abdul Rahmani for suggesting major changes. Download the above code from here .

#4y: Codding in Python {Hand-Cricket Again}

Image
aukaat = [1,2,3,4,5,6,6,6,6,5,4,5,4,4,5] import random as randi def arranger(string):     k = []     for i in (string):         i = i.lower()         k.append(i)     l = ''     for i in (k):         l = l + i     return  l def bat():     global BATscore, Wickets, balls     batsman = int(input('Enter Hit number: '))     bowler = randi.choice(aukaat)     print('Your choice = ', batsman," Computer's choice = ", bowler)     print()     if batsman in range(1,7):         balls +=1         if bowler == batsman:             #out             print('Out!')             Wickets += 1         else:             BATscore += batsman          if final == 'ball':         print()         print('                                         Target = ', Target, '   Runs Required = ', Target - BATscore)          print('                                                                                                                           

#4x: Codding in Python {Rock-Paper-Scissor}

Image
 #imcool list1 = [1,2,3] scoreP = 0 scoreB = 0 import random def logic(i,j):     global scoreP, current     #Rock     if i == 1 and j == 1: current = 0;      if i == 1 and j == 2: current = -1;      if i == 1 and j == 3: current = 1;      #Paper     if i == 2 and j == 1: current = 1;      if i == 2 and j == 2: current = 0;      if i == 2 and j == 3: current = -1;      #Scissor      if i == 3 and j == 1: current = -1;      if i == 3 and j == 2: current = 1;      if i == 3 and j == 3: current = 0;      return current def gap(n):     for i in range(n):         print() def wot(m):     if m == 1: dho = "Rock"     if m == 2: dho = "Paper"     if m == 3: dho = "Scissor"     return dho limit = int(input("Enter score limit:")) while 1==1:     gap(10)     if scoreB == limit-1 or scoreP == limit-1: print("MATCH POINT!")     print("1 = Rock")     print("2 = Paper")     print("3 = Scissor")     player = int(input("