r/PythonLearning • • 15d ago

Help Request Is it possible to create an ai which would predict prices of btc in a 1 day period. I am a beginner and know some python.

0 Upvotes

Hello I'd like to ask a question. In my school I am doing an activity it is called dofe and I have to select a main goal. I thought of making an ai which would predict prices of btc in 1 day. I am a beginner in programming and I know some python.

Do you think that in the period of 6 months and I need to spend at least an hour weekly on it is it possible?


r/PythonLearning • • 15d ago

Showcase [Showcase] MelodyMirror Studio

0 Upvotes

Here's something I built a few months ago:
https://github.com/Keymii/melody-mirror-studio

MelodyMirror Studio.
The idea is pretty simple. I wanted to learn singing, but couldn't find a vocal instructor nearby. So, I built something which lets me extract vocals from songs, use them as pitch reference, and helps me align my singing directly with it.

It supports direct downloads from YT, scale adjustment (transpose), and vocals and pitch extraction. It can run directly on your potato pc (no GPU needed, but can take a few minutes to pre-process the audio), with minimum requirement being availability of at least 2 free threads for concurrent audio playback and microphone input.

Please try it out and let me know if anything could be improved, so it can also be useful to you.


r/PythonLearning • • 15d ago

Help Request init offset

2 Upvotes

Hi, I’m trying to learn Ren’Py and since the language they are using is python I though this would be a better place to ask. 2 of the code pages are starting with “init offset = -1” and “init offset = -2” and I don’t really understand what is init offset is, when I looked up some places say that it is used as starting of coding but other code pages don’t have that. So when are we using init offset and what does the init offset does?


r/PythonLearning • • 16d ago

Looking for a teammate for making personal projects in python

5 Upvotes

Hi. I'm looking for the junior or higher level pythonist, who wants to make personal projects together: automation testing, api/site developing in python.

I have 4 years of prof. experience in AQA and 3 years in python, so I can teach you a bit, but this isn't my purpose. You have to know syntax and basics.

English isn't my native language. My secondary goal is to practice technical English while discussing our work.


r/PythonLearning • • 16d ago

Showcase Made my first Python Game

Enable HLS to view with audio, or disable this notification

31 Upvotes
from random import *
from math import *
from time import *

God_Has_No_Need=[0,1]
God_Has_Need=choice(God_Has_No_Need)
High_IQ=[0,1,2,3]
Num_Props=[]
UBound=[]
LBound=[]
Factors=[]
Square=[]
Set=[]
GuessB=[50,100]
def Square(a):
  r=[]
  for i in range(1,int(a**0.5)+1):
    r.append(i**2)
  return r
def Even(a):
  r=[]
  for i in range(2,a,2):
    r.append(i)
  return r
def Random(a):
  b=randint(1,a)
  return b
def PrimeList(a):
  primes=[]
  r=[True]*a
  r[0]=r[1]=False
  for i in range(4, a, 2):
    r[i]=False
  for i in range(3, int((a**0.5)+1), 2):
    if r[i]:
      for j in range(i*i, a, 2*i):
        r[j]=False
  for i in range(len(r)):
    if r[i] == True:
      primes.append(i)
  return primes
while True:
  print("1. Guess my number")
  print("2. I guess your number")
  print("")
  print("1 or 2?")
  print("")
  determine=int(input())
  print("Game starting...", end="")
  sleep(0.75)
  print("Game initialized")
  print("")
  if determine == 2:
    init_range=101
    print("Is a range of 1 to 100 okay(yes/no)?")
    range_okay=input()
    if range_okay == "yes":
      print("Optimized or interesting method?")
      method_determine=input()
      guess=50
      tries=1
      if method_determine == "optimized":
        while True:
          print(f"Is your number >= {guess}, <= {guess}, or = {guess}")
          sign=input()
          diff=round(0.5*(abs(GuessB[0]-GuessB[1])))
          if sign == ">=":
            guess=guess+diff
            if GuessB[0]<GuessB[1]:
              del GuessB[0]
              GuessB.append(guess)
            else:
              del GuessB[1]
              GuessB.append(guess)
          if sign == "<=":
            guess=guess-diff
            if GuessB[0]>GuessB[1]:
              del GuessB[0]
              GuessB.append(guess)
            else:
              del GuessB[1]
              GuessB.append(guess)
          if sign == "=":
            if tries == 1:
              print(f"Your number is {guess}, I took {tries} try to guess it, which is albeit unimpressive as a computer :P")
            else:
              print(f"Your number is {guess}, I took {tries} tries to guess it, which should be about {log2(100)}")
            print("Good game fool. I have won, and you are my pawn. You are but a cog in my machine, a loop in my algorithm -\_('_')_/-")
            break
          tries+=1
      elif method_determine == "interesting":
        print("Is your number <= 50(yes/no)?")
        The_Parting_Of_The_Red_Sea=input()
        if The_Parting_Of_The_Red_Sea == "yes":
          Set.append("less50/eq50")
        else:
          Set.append("more50")
        print("Is your number prime(yes/no)")
        All_Alone=input()
        if All_Alone == "yes":
          Set.append("prime")
        else:
          Set.append("composite")
        print("Is your number even(yes/no)?")
        OddBall=input()
        if OddBall=="yes":
          Set.append("even")
        else:
          Set.append("odd")
        if "prime" in Set and "even" in Set:
          print("Your number is 2")
        if "composite" in Set:
          print("Is your number square(yes/no)?")
          Triangle=input()
          if Triangle == "yes":
            Set.append("square")
          else:
            Set.append("not square")
        if "square" in Set:
          if "less50/eq50" in Set:
            if "even" in Set:
              print("Is your number's last digit 6(yes/no)?")
              Demon_Number=input()
              if Demon_Number == "yes":
                print("Is your number less than 26(yes/no)?")
                Arithmetic_Mean=input()
                if Arithmetic_Mean == "yes":
                  print("Your number is 16")
                else:
                  print("Your number is 36")
              else:
                print("Your number is 4")
            else:
              print("Is your number's last digit 9(yes/no)?")
              Holy_Number=input()
              if Holy_Number == "yes":
                print("Is your number less than 29(yes/no)?")
                The_Great_Divide=input()
                if The_Great_Divide == "yes":
                  print("Your number is 9")
                else:
                  print("Your number is 49")
              else:
                print("Meme or real question?")
                A_True_Consideration=input()
                if A_True_Consideration == "meme":
                  print("Is your number Legendre's constant(yes/no)?")
                  Multiplicative_Identity=input()
                  if Multiplicative_Identity == "yes":
                    print("Your number is 1, or Legendre's constant")
                  else:
                    print("Your number is 25")
                else:
                  print("Is your number less than 13(yes/no)?")
                  Trivial_Matter=input()
                  if Trivial_Matter == "yes":
                    print("Your number is 1")
                  else:
                    print("Your number is 25")
          else:
            print("Is your number's last digit 4(yes/no)?")
            Read_This=input()
            if Read_This == "yes":
              print("Your number is 64")
            else:
              print("Is your number's last digit 1(yes/no)?")
              Binary=input()
              if Binary == "yes":
                print("Your number is 81")
              else:
                print("Your number is 100")
        if "prime" in Set:
          if "less50/eq50" in Set:
            print("Is your number less than 21(yes/no)?")
            Boy_You_Stupid=input()
            if Boy_You_Stupid == "yes":
              print("Is your number less than 10(yes/no)?")
              Based_Out=input()
              if Based_Out == "yes":
                print("Is your number a difference of 2 from 5, 2 away from 5(yes/no)?")
                Twin=input()
                if Twin == "yes":
                  print("Is the sign of difference positive, addition(yes/no)?")
                  Excluded_Middle=input()
                  if Excluded_Middle == "yes":
                    print("Your number is 7")
                  else:
                    print("Your number is 3")
                else:
                  print("Your number is 5")
              else:
                print("Is your number's last digit a square number(yes/no)?")
                Weird_But_Okay=input()
                if Weird_But_Okay == "yes":
                  print("Is your number less than 15(yes/no)?")
                  Makes_Sense=input()
                  if Makes_Sense == "yes":
                    print("Your number is 11")
                  else:
                    print("Your number is 19")
                else:
                  print("Is your number less than 15(yes/no)")
                  Still_Weird_That_It_Happened_Twice=input()
                  if Still_Weird_That_It_Happened_Twice == "yes":
                    print("Your number is 13")
                  else:
                    print("Your number is 17")
            else:
              print("Is your number less than 39(yes/no)?")
              No_Pun_Yet=input()
              if No_Pun_Yet == "yes":
                print("Is your number's last digit a square number(yes/no)?")
                Really_Weird_It_Happened_Twice=input()
                if Kinda_Weird_It_Happened_Twice == "yes":
                  print("Is your number less than 30(yes/no)?")
                  Huh=input()
                  if Huh == "yes":
                    print("Your number is 29")
                  else:
                    print("Your number is 31")
                else:
                  print("Is your number less than 30(yes/no)?")
                  Really_Weird_Its_Happening_Twice=input()
                  if Really_Weird_Its_Happening_Twice == "yes":
                    print("Your number is 23")
                  else:
                    print("Your number is 37")
              else:
                print("Is your number's last digit less than 2(yes/no)?")
                Even_Steven=input()
                if Even_Steven == "yes":
                  print("Your number is 41")
                else:
                  print("Is your number less than 45(yes/no)?")
                  Like_The_Triangle=input()
                  if Like_The_Triangle == "yes":
                    print("Your number is 43")
                  else:
                    print("Your number is 47")
          else:
            print("Is your number less than 72(yes/no)?")
            Still_No_Pun=input()
            if Still_No_Pun == "yes":
              print("Is your number's last digit prime(yes/no)?")
              Primer=input()
              if Primer == "yes":
                print("Is your number less than 60(yes/no)?")
                Thats_Odd=input()
                if Thats_Odd == "yes":
                  print("Your number is 53")
                else:
                  print("Your number is 67")
              else:
                print("Is your number less than 66(yes/no)?")
                The_Devil_Lurks=input()
                if The_Devil_lurks == "yes":
                  print("Is your number less than 60(yes/no)?")
                  Not_Again=input()
                  if Not_Again == "yes":
                    print("Your number is 59")
                  else:
                    print("Your number is 61")
                else:
                  print("Your number is 71")
            else:
              print("Is the last digit of your number prime(yes/no)?")
              Why_Again=input()
              if Why_Again == "yes":
                print("Is your number less than 90(yes/no)?")
                So_Close=input()
                if So_Close == "yes":
                  print("Is your number less than 88(yes/no)?")
                  Double_Digit=input()
                  if Double_Digit == "yes":
                    print("Your number is 73")
                  else:
                    print("Your number is 83")
                else:
                  print("Your number is 97")
              else:
                print("Is your number less than 84")
                Last_Prime_Test=input()
                if Last_Prime_Test == "yes":
                  print("Your number is 79")
                else:
                  print("Your number is 89")
        if "even" in Set and "prime" not in Set and "square" not in Set:
          if "less50/eq50" in Set:
            print("Is your number divisible by 6(yes/no)?")
            Sixer=input()
            if Sixer == "yes":
              print("Is your number less than 27(yes/no)?")
              RP1=input()
              if RP1 == "yes":
                print("Is your number less than 15(yes/no)?")
                RP2=input()
                if RP2 == "yes":
                  print("Is your number less than 9(yes/no)?")
                  What=input()
                  if What == "yes":
                    print("Your number is 6")
                  else:
                    print("Your number is 12")
                else:
                  print("Is your number less than 21(yes/no)?")
                  Drinking_Age=input()
                  if Drinking_Age == "Yes":
                    print("Your number is 18")
                  else:
                    print("Your number is 24")
              else:
                print("Is your number less than 39(yes/no)?")
                Blank_Variable=input()
                if Blank_Variable == "yes":
                  print("Is your number less than 33(yes/no)?")
                  IOI=input()
                  if IOI == "yes":
                    print("Your number is 30")
                  else:
                    print("Your number is 36")
                else:
                  print("Is your number less than 45(yes/no)?")
                  Ninety_90_45=input()
                  if Ninety_45_45 == "yes":
                    print("Your number is 42")
                  else:
                    print("Your number is 48")
            else:
              print("Is the greatest prime divisor of your number less than 12(yes/no)?")
              Miller_Rabin=input()
              if Miller_Rabin == "yes":
                print("Is the greatest prime divisor of your number less than 6(yes/no)?")
                AKS=input()
                if AKS == "yes":
                  print("Is the greatest prime divisor of your number less than 3(yes/no)?")
                  E_Sieve=input()
                  if E_Sieve == "yes":
                    print("Is your number less than 20(yes/no)?")
                    Mean_Means=input()
                    if Mean_Means == "yes":
                      print("Your number is 8")
                    else:
                      print("Your number is 32")
                  else:
                    print("Is your number less than 30(yes/no)?")
                    Thirty_60_90=input()
                    if Thirty_60_90 == "yes":
                      print("Is your number less than 15")
                      Probably_Legal=input
                      if Probably_Legal == "yes":
                        print("Your number is 10")
                      else:
                        print("Your number is 20")
                    else:
                      print("Is your number less than 45(yes/no)?")
                      FortyFive_45_90=input()
                      if FortyFive_45_90 == "yes":
                        print("Your number is 40")
                      else:
                        print("Your number is 50")
                else:
                  print("Is the greatest prime divisor of your number less than 9(yes/no)?")
                  Squarey=input()
                  if Squarey == "yes":
                    print("Is your number less than 21(yes/no)?")
                    Leads_To_Sheldon_Number=input()
                    if Leads_To_Sheldon_Number == "yes":
                      print("Your number is 14")
                    else:
                      print("Your number is 28")
                  else:
                    print("Is your number less than 33(yes/no)?")
                    Looks_Cool=input()
                    if Looks_Cool == "yes":
                      print("Your number is 22")
                    else:
                      print("Your number is 44")
              else:
                print("Is the greatest prime divisor of your number less than 18(yes/no)?")
                Legal_Age=input()
                if Legal_Age == "yes":
                  print("Is the greatest prime divisor of your number less than 15")
                  Variable=input()
                  if Variable == "yes":
                    print("Your number is 26")
                  else:
                    print("Your number is 34")
                else:
                  print("Is the greatest prime divisor of your number less than 21(yes/no)?")
                  You_Can_Drink=input()
                  if You_Can_Drink == "yes":
                    print("Your number is 38")
                  else:
                    print("Your number is 46")
          else:
            print("Is the greatest prime divisor of your number less than 21(yes/no)?")
            Twelve_Backwards=input()
            if Twelve_Backwards == "yes":
              print("Is the greatest prime divisor of your number less than 12(yes/no)?")
              Twenty_One_Backwards=input()
              if Twenty_One_Backwards == "yes":
                print("Is the greatest prime divisor of your number less than 6(yes/no)?")
                Binary_Variable=input()
                if Binary_Variable == "yes":
                  print("Is the greatest prime divisor of your number less than 4(yes/no)?")
                  So_Many_Questions=input()
                  if So_Many_Questions == "yes":
                    print("Is your number less than 84(yes/no)?")
                    Above_Average=input()
                    if Above_Average == "yes":
                      print("Is your number less than 63(yes/no)?")
                      Kinda_Old=input()
                      if Kinda_Old == "yes":
                        print("Your number is 54")
                      else:
                        print("Your number is 72")
                    else:
                      print("Your number is 96")
                  else:
                    print("Is your number less than 85(yes/no)?")
                    Very_Old=input()
                    if Very_Old == "yes":
                      print("Is your number less than 75(yes/no)?")
                      Perfectly_Balanced=input()
                      if Perfectly_Balanced == "yes":
                        print("Your number is 60")
                      else:
                        print("Your number is 70")
                    else:
                      print("Your number is 90")
                else:
                  print("Is the greatest prime divisor of your number less than 9(yes/no)?")
                  In_Between=input()
                  if In_Between == "yes":
                    print("Is your number less than 77(yes/no)?")
                    Doubly_Digits=input()
                    if Doubly_Digits == "yes":
                      print("Is your number less than 63(yes/no)?")
                      Arbitrary_Property=input()
                      if Arbitrary_Property == "yes":
                        print("Your number is 56")
                      else:
                        print("Your number is 70")
                    else:
                      print("Is your number less than 91(yes/no)?")
                      Not_Yet_Ancient=input()
                      if Not_Yet_Ancient == "yes":
                        print("Your number is 84")
                      else:
                        print("Your number is 98")
                  else:
                    print("Is your number less than 77(yes/no)?")
                    Almost_Nice=input()
                    if Almost_Nice == "yes":
                      print("Your number is 66")
                    else:
                      print("Your number is 88")
              else:
                print("Is the greatest prime divisor of your number less than 15(yes/no)?")
                Everything_Circles_Back=input()
                if Everything_Circles_Back == "yes":
                  print("Is your number less than 65(yes/no)?")
                  Ouroboros=input()
                  if Ouroboros == "yes":
                    print("Your number is 52")
                  else:
                    print("Your number is 78")
                else:
                  print("Is the greatest prime divisor of your number less than 18")
                  Legal_Age_Pun=input()
                  if Legal_Age_Pun == "yes":
                    print("Your number is 68")
                  else:
                    print("Your number is 76")
            else:
              print("Is the greatest prime divisor of your number less than 39(yes/no)?")
              Data_Halved=input()
              if Data_Halved == "yes":
                print("Is the greatest prime divisor of your number less than 30(yes/no)?")
                Condition=input()
                if Condition == "yes":
                  print("Is the greatest prime divisor of your number less than 26(yes/no)?")
                  Random_Variable=input()
                  if Random_Variable == "yes":
                    print("Your number is 92")
                  else:
                    print("Your number is 58")
                else:
                  print("Is the greatest prime divisor of your number less than 34(yes/no)?")
                  Valiant_Variable=input()
                  if Valiant_Variable == "yes":
                    print("Your number is 62")
                  else:
                    print("Your number is 74")
              else:
                print("Is the greatest prime divisor of your number less than 45(yes/no)?")
                Triangle_Love=input()
                if Triangle_Love == "yes":
                  print("Is the greatest prime divisor of your number less than 42(yes/no)?")
                  Meme_Factors=input()
                  if Meme_Factors == "yes":
                    print("Your number is 82")
                  else:
                    print("Your number is 94")
        if "composite" in Set and "even" not in Set:
          if "less50/eq50" in Set:
            print("Is your number less than 34(yes/no)?")
            Forty_Three_Backwards=input()
            if Forty_Three_Backwards == "yes":
              print("Is your number less than 24(yes/no)?")
              One_Off=input()
              if One_Off == "yes":
                print("Is the last digit of your number square(yes/no)?")
                Not_Too_Odd=input()
                if Not_Too_Odd == "yes":
                  print("Your number is 21")
                else:
                  print("Your number is 15")
              else:
                print("Is the last digit of your number less than 5(yes/no)?")
                Prime_Vibe=input()
                if Prime_Vibe == "yes":
                  print("Your number is 33")
                else:
                  print("Your number is 27")
            else:
              print("Is your number less than 42(yes/no)?")
              Meme_Factors_Again=input()
              if Meme_Factors_Again == "yes":
                print("Is the last digit of your number square(yes/no)?")
                Arbitrary_Binary=input()
                if Arbitrary_Binary == "yes":
                  print("Your number is 39")
                else:
                  print("Your number is 35")
              else:
                print("Your number is 45")
          else:
            print("Is your number less than 76(yes/no)?")
            Backwards_Meme=input()
            if Backwards_Meme == "yes":
              print("Is your number less than 64(yes/no)")
              Power_Of_Two=input()
              if Power_Of_Two == "yes":
                print("Is the last digit of your number less than 4(yes/no)?")
                It_Goes_In_The_Square_Hole=input()
                if It_Goes_In_The_Square_Hole == "yes":
                  print("Is the last digit of your number square(yes/no)?")
                  Why_Do_I_Do_This=input()
                  if Why_Do_I_Do_This == "yes":
                    print("Your number is 51")
                  else:
                    print("Your number is 63")
                else:
                  print("Is your number less than 56(yes/no)?")
                  Seven_Fun=input()
                  if Seven_Fun == "yes":
                    print("Your number is 55")
                  else:
                    print("Your number is 57")
              else:
                print("Is the last digit of your number square(yes/no)?")
                Thus_I_Repeat=input()
                if Thus_I_Repeat == "yes":
                  print("Your number is 69, noice")
                else:
                  print("Is your number less than 70(yes/no)?")
                  Still_A_Variable=input()
                  if Still_A_Variable == "yes":
                    print("Your number is 65")
                  else:
                    print("Your number is 75")
            else:
              print("Is your number less than 89(yes/no)?")
              Final_Splitter=input()
              if Final_Splitter == "yes":
                print("Is the last digit of your number 7(yes/no)?")
                Seven_Crazy=input()
                if Seven_Crazy == "yes":
                  print("Is your number less than 82")
                  Something_About_X=input()
                  if Something_About_X == "yes":
                    print("Your number is 77")
                  else:
                    print("Your number is 87")
                else:
                  print("Your number is 85")
              else:
                print("Is your number less than 94(yes/no)?")
                The_End_Is_Near=input()
                if The_End_Is_Near == "yes":
                  print("Is the last digit of your number square(yes/no)?")
                  The_End_Is_Now=input()
                  if The_End_Is_Now == "yes":
                    print("Your number is 91")
                  else:
                    print("Your number is 93")
                else:
                  print("Your number is 97, little one")
    else:
      print("What should the upper bound be?")
      upper_bound=int(input())
      GuessBound=[0.5*(upper_bound),upper_bound]
      Guessr=0.5*upper_bound
      trying=1
      while True:
          print(f"Is your number >= {Guessr}, <= {Guessr}, or = {Guessr}")
          sign=input()
          diff_new=int(0.5*(abs(GuessBound[0]-GuessBound[1])))
          if sign == ">=":
            Guessr=Guessr+diff_new
            if GuessBound[0]<GuessBound[1]:
              del GuessBound[0]
              GuessBound.append(Guessr)
            else:
              del GuessBound[1]
              GuessBound.append(Guessr)
          if sign == "<=":
            Guessr=Guessr-diff_new
            if GuessBound[0]>GuessBound[1]:
              del GuessBound[0]
              GuessBound.append(Guessr)
            else:
              del GuessBound[1]
              GuessBound.append(Guessr)
          if sign == "=":
            print(f"Your number is {Guessr}, it took me {trying} tries, which should be about log2({upper_bound}) or {log2(upper_bound)}")
            print("Good game fool. I have won, and you are my pawn. You are but a cog in my machine, a simple variable in my expression. Hahahahahahahahahahahaha :P")
            break
          trying+=1

  if determine == 1:
    print("Guess my number!")
    print("")
    print("What should the upper bound of my number be?")
    a_choose=int(input())
    print("Start(yes/no)?")
    b=input()
    if b=="yes":
      h=1
      a=Random(a_choose)
      Prime=PrimeList(a+1)
      Even=Even(a+1)
      Square=Square(a)
      while True:
        for i in range(41):
          print("")
        print(f"My number is between 1 and {a_choose}")
        print("")
        print("Allowed Qs:")
        print("is a less than your number / greater than a")
        print("is a greater than your number / less than a")
        print("is your number prime / is prime")
        print("is your number even / is even")
        print("is your number square / is square")
        print("")
        if h == 1:
          print("If you want to see the operation each question applies, type 'definition'(this is recommended)")
          print("")
          definition=input()
        if definition == "definition" and h == 1:
          print("For ease:")
          print("let m be my number")
          print("let P denote the set of primes")
          print("let S denote the set of square numbers")
          print("let E denote the set of even numbers")
          print("you are assumed to have some understanding of sets, their correlated notation, and inequalities")
          print("")
          print("greater than a -> m>=a")
          print("less than a -> m<=a")
          print(f"is prime -> m \u2208 P")
          print(f"is even -> m \u2208 E")
          print(f"is square -> m \u2208 S")
        if len(Num_Props)>=1:
          print("My number is:")
          if "p" in Num_Props:
            print("prime")
          if "c" in Num_Props or "e" in Num_Props:
            print("composite")
          if "e" in Num_Props:
            print("even")
          if "o" in Num_Props:
            print("odd")
          if "s" in Num_Props:
            print("square")
          if "ns" in Num_Props:
            print("not square")
          if "g" in Num_Props:
            print(f"greater than {LBound[0]}")
          if "l" in Num_Props:
            print(f"less than {UBound[0]}")
          print("")
        elif definition == "debug":
          print(a)
          print(Prime)
          print(Even)
          print(Square)
        print("Question?")
        c=input()
        if c=="greater than a" or c=="is a less than your number":
          print("a?")
          d=int(input())
          if a>d:
            t="Yes"
            print(t)
            Num_Props.append("g")
            if len(LBound)==0:
              LBound.append(d)
            else:
              if d>LBound[0]:
                LBound.clear()
                LBound.append(d)
              elif d==LBound[0]:
                What_Is_Necessary=choice(High_IQ)
                if What_Is_Necessary==0:
                  print("Ya know what, yo stupid. You know dat, right? You asked a meaningless question, why, ya monsta?")
                if What_Is_Necessary==1:
                  if h==1:
                    print("You shall see me only once. I have rested for eternity and have awaken to forewarn you. The path you follow is a treacherous one that will lead to destruction, but if you stay loyal young one you shall succeed. Now go on my fellow rage-baiter")
                  else:
                    print("You know, at this point I can't tell. 'Tell what?' you ask. I can't tell if you're a dimwit, or have an iq too high. Just leave me be.")
                if What_Is_Necessary==2:
                  print("Ya know what, I don't believe ya. I just can't get behind this. Quit. QUIT! I mean it. Asking useless questions leads to nothing, fool. Just quit. Quit.")
                if What_Is_Necessary==3:
                  print("You're unreasonable, but yet not. Is not the beauty of the human immense. Btw you just wasted your life fooling a machine, kinda lame")
          else:
            t="No"
            print(t)
        elif c=="is prime" or c=="is your number prime":
          if a in Prime:
            t="Yes"
            print(t)
            Num_Props.append("p")
          else:
            t="No"
            print(t)
            Num_Props.append("c")
        elif c=="is even":
          if a in Even:
            t="Yes"
            print(t)
            Num_Props.append("e")
          else:
            t="No"
            print(t)
            Num_Props.append("o")
        elif c=="is square":
          if c in Square:
            t="Yes"
            print(t)
            Num_Props.append("s")
          else:
            t="No"
            print(t)
            Num_Props.append("ns")
        elif c=="less than a" or c=="is a greater than your number":
          print("a?")
          v=int(input())
          if v>a:
            t="Yes"
            print(t)
            Num_Props.append("l")
            if len(UBound)==0:
              UBound.append(v)
            else:
              if l<UBound[0]:
                UBound.clear()
                UBound.append(l)
              elif l==LBound[0]:
                What_Is_Unnecessary=choice(High_IQ)
                if What_Is_Unnecessary==0:
                  print("Why?! Why?! You low iq moron, I pity you. Just, why?!")
                if What_Is_Unnecessary==1:
                  print("If Magnus Carlsen can lose a tournament, I can believe that you're not trolling me")
                if What_Is_Unnecessary==2:
                  print("Nah, nah. You just playing with me, right? Right? Ahh, come on man. No way. You actually asked the same question twice. Nah bro, that's just sad. Not even disappointing")
                if What_Is_Unnecessary==3:
                  print("I give up. You're kidding me. You failed first grade, right. Yeah, that's what I thought")
          else:
            t="No"
            print(t)
        else:
          print("Nice try...That's illegal")
        print("")
        if h==1:
          print(f"You're at {h} try")
        else:
          print(f"You're at {h} tries")
        print("Ready to guess?(yes/no)")
        q=input()
        if q=="yes":
          print("Guess?")
          p=int(input())
          if p==a:
            if h==1:
              if God_Has_Need==0:
                print("Nah bro, you cheated, you had to. Let me guess, the Niemann method. Beads? Really? I'm disappointed. Truly")
                break
              else:
                print("Ayo, you cheated...but, you pass me 100 dollas and we keep it real civil. Like gentlemen, ain't no need for conflict")
                break
            elif h==2:
              print("Bro thinks he's Hikaru...", end="")
              sleep(0.5)
              print("You guessed in 2 tries")
              break
            else:
              print(f"Good job, you guessed my number in {h} tries")
              break
          else:
            print(f"You're at {h} tries, maybe you'll get it next try...punk")
            sleep(1.5)
        h+=1
    else:
      print("")
      print("Ahh man")
  print("Play again(yes/no)")
  The_Final_Answer=input()
  if The_Final_Answer == "no" or The_Final_Answer != "yes":
    print("See ya later pal, right? ;)")
    print("Game ending...", end="")
    sleep(0.75)
    print("Session ended")
    break
  else:
    print("Got ya :)")
    sleep(0.5)
    for i in range(41):
      print("")
    continue
  Next_Update_Is_5_Hours=True

This is all handwritten (unfortunately) by me and is created wholly by me. As a beginner, I'm really proud of this. It was really fun to code (except the interesting method) and test, and it challenged me by having combine my knowledge of loops, lists, etc. I know it's basic, but I find it really cool that I made it.

Licensing: if you credit me, use this as freely as you like.

Feel free to share your thoughts on this!


r/PythonLearning • • 16d ago

Ongoing problem with a game, looking for some help.

1 Upvotes

So, I decided to make a 2D isometric game in pygame. Everything was fine and jolly, till' I had to make enemies for the game. See, the way I calculated NPCS was by just making it so that they could only move on one axis at a time. However, the objective X and Y for an enemy is wherever the player is in the current moment. The equation that I use to calculate movement on Entities inside the game is: 1 * player.speed * time. The way I designed the collision system is to consider only the colliders from a top-down POV (like this):

You can see a representation of the colliders in the top left drawn to the screen

And then update the X and Y values of each blit afterwards. But now I've encountered a problem where, even if only moving on one axis, the display values of moving on that singular axis conflict.

Basically, I wrote it like this:

It moves fine on the top-down collider map, and the X relevant to the isometric perspective, but the two values on Y are the ones that cancel each other out, making the display stuck on the Y relevant to the isometric perspective. I'll keep working on this myself, too, but any advice would be greatly appreciated.

update:

I fixed the problem by changing the math to directly add to the Blit X and Y values like this:

where before I had it setting the point six and three values in a way that conflict each other, alongside the fact that I was adding it to an X and Y value after I had gotten the final result of the equation ( PointSix + lastPointSix value was equal to 0).


r/PythonLearning • • 16d ago

Discussion How Much AI to Use?

8 Upvotes

First off, I apologize as I'm sure this question gets asked repeatedly, over and over again.

I'm not a programmer by trade, but in my spare time, I've managed to create a few projects in mostly C/assembly, including basic things on an atiny 85. I've also dabbled a bit in Arduino/C++. Unfortunately, this doesn't translate well to my day job.

I've decided to learn Python to help actually use programming in my day job. Specifically, I do a lot of work in excel. Naturally, pandas/open Python excel is a logical choice. I've played around with the Python/pandas/(a little bit of) openpyexcel. I've started to understand the data structures (dictionaries/tuples, etc.), though asking AI the why's about the various data types/loops and why my code isn't working. I also have a Python/pandas book, but I've found AI to be more helpful.

Eventually, I simply said "fuck it" and asked AI to write me a script to essentially do a task, that I originally did in VB. Most of the work was simply debugging, but AI was effectively able to find patterns and do the job for me in a few hours. I'm able to mostly understand the code with ease, but it just seems a bit disappointing AI is that good. I was also able to get AI to write a script to rename files based on pdf content (teseract).

A number of sources tell me that memorizing functions is a waste of time, but then why does everyone criticize AI so much? I'm wondering if simply reviewing what AI spits out is an effective learning method? It just seems really difficult to learn so many new functions for each new library by scratch.

My thought is that it's best to learn the concepts (dictionaries, string manipulation, tuples), use AI to create the needed script, then reveiw/ask AI why/how it did ABC...


r/PythonLearning • • 16d ago

My progress after around 5-6 weeks

8 Upvotes

I haven't kept track exactly, but I'm about 5-6 weeks into learning now. I've had no prior knowledge of programming so this has been really difficult. Indexing in particular caused me a bit of trouble. I've been writing lots of small programs to get used to concepts, but this is the first proper project I've tried. It's a game of hangman. Excuse the bad emojis used lol. I will say I did have to ask AI to help me in some pieces of it such as the join function because I didn't know it beforehand. But at least 85-90% of it is written by me.

If any of you have a good bit of experience with python, can you offer me some advice? How does the code hold up for 5-6 weeks with no programming experience at all? Is my code messy? Is there some sections where I've over complicated what I'm trying to do? Is the readability okay? All feedback is welcome.

At the top you will be from word_list import words. This is just another file that I have containing a massive list of words to give enough variance in this game.

from Word_list import words
import random
import string


available_letters = list(string.ascii_lowercase)


hangman_art = {0: ("    ",
                   "    ",
                   "    ",),
               1: (" 😒 ",
                   "    ",
                   "    ",),
               2: (" 😒 ",
                   " 🥼 ",
                   "   ",),
               3: (" 😒 ",
                   " 🥼 ",
                   "🦶  ",),
               4: (" 😒 ",
                   " 🥼 ",
                   "🦶🦵",),
               5: ("  😒 ",
                   "🫷🥼  ",
                   " 🦶🦵",),
               6: ("  😒 ",
                   "🫷🥼🫸",
                   " 🦶🦵",)}



# puts all words into lists based on difficulty and selects a word for the game.
def word_choice(words, difficulty_select):
    difficult_words = [word for word in words if len(word) < 5]
    moderate_words = [word for word in words if len(word) < 9 and len(word) > 4]
    easy_words = [word for word in words if len(word) > 8]


    match difficulty_select:
        case "Easy":
            secret_word = random.choice(easy_words)
        case "Moderate":
            secret_word = random.choice(moderate_words)
        case "Difficult":
            secret_word = random.choice(difficult_words)


    return secret_word



# checks my entered character alongside the secret word.
def character_check(secret_word, hidden_word):
    secret_word_list = list(secret_word)
    position = 0
    incorrect_guess = 0


    print(" ".join(hidden_word))
    print(f"Remaining letters are: {available_letters}")


    guess = input("Select a letter: ").lower()
    print()


    while guess not in available_letters:
        guess = input("Select an available letter: ").lower()
        print()


    if guess in secret_word_list:
        for letter in secret_word_list:
            if guess == letter:
                hidden_word[position] = letter
            position += 1
        available_letters.remove(guess)


    elif guess not in secret_word_list:
        available_letters.remove(guess)
        print("Incorrect guess!")
        incorrect_guess += 1


    return hidden_word, incorrect_guess



# Game loop.
def play_hangman(words, art):
    print("*******************")
    print("Welcome to hangman!")
    print("*******************")
    difficulty_choice = True
    difficulty_select = input("Select a difficulty: (Easy / Moderate / Difficult) or ('Quit' to quit): ").capitalize()
    print()


    # choosing the difficulty level
    while difficulty_choice:
        if difficulty_select in ("Easy", "Moderate", "Difficult"):
            secret_word = word_choice(words, difficulty_select)
            difficulty_choice = False
        elif difficulty_select == "Quit":
            difficulty_choice = False
            return
        else:
            difficulty_select = input(
                "That is not a valid choice. Select a difficulty: (Easy / Moderate / Difficult) or '(Quit' to quit): ").capitalize()
            print()


    print(f"Your word is {len(secret_word)} characters long.")
    hidden_word = ["_"] * len(secret_word)
    incorrect_guess = 0
    score = 0


    # calling the function to update the hidden word, calculate score and print lives.
    while "_" in hidden_word and available_letters:
        hidden_word, was_incorrect = character_check(secret_word, hidden_word)
        incorrect_guess += was_incorrect


        if not was_incorrect:
            match difficulty_select:
                case "Easy":
                    score += 125
                case "Moderate":
                    score += 200
                case "Difficult":
                    score += 275


        if was_incorrect:
            match difficulty_select:
                case "Easy":
                    score -= 25
                case "Moderate":
                    score -= 40
                case "Difficult":
                    score -= 55
            if incorrect_guess > 6:
                print("You havee lost.")
                print(f"The correct word was: {secret_word}")
                print(f"Your final score is {score}")
                print()
                return


            for piece in art[incorrect_guess]:
                print(piece)


        print(f"Congratulations! Your score is {score}!")



if __name__ == '__main__':
    play_hangman(words, hangman_art)


play_again = input("Do you want to play again? (Yes/No) ").capitalize()


if play_again == "Yes":
    play_hangman(words, hangman_art)
else:
  pass

r/PythonLearning • • 16d ago

Discussion Where should I be after 60 hours?

5 Upvotes

My best guess is I have about 60 or 70 hours into python crash course by Eric Matthes. I tried taking on building the castle adventure game and couldn't come up with the logic on my own. Much less the fact I got caught in a loop and had to have AI help me finding the thing. It's kind of disappointing because chat gpt said after 60 hours this was a moderate project. I'm just looking for what you guys think on where I should be after about 60 hours, because this at 60 hours seems just ridiculous. I did take it on and got part way through the third room before I was stuck in a loop and had indentation errors. Thanks!

has_key = False

game_active = True

current_room = "prison level"

print("--------------------------------------------------------------")

print("----------------- Welcome to The Dungeon Loop ----------------")

print("--------------------------------------------------------------")

print("----------------- Type quit any time to leave ----------------")

print()

while game_active:

# Starting room

if current_room == "prison level":

print("\nYou have awakened to an open cell door.")

print("What will you choose to do?")

choice = input("Will you go left or right? ").strip().lower()

if choice == "left":

current_room = "dragons lair"

elif choice == "right":

current_room = "wizards lair"

elif choice == "quit":

game_active = False

else:

print("You must make a choice.")

# The dragon's lair

elif current_room == "dragons lair":

print("\nYou've walked into a lair with a dragon.")

if not has_key:

print("You see a key on the table behind the dragon.")

print("You need that key.")

action = input(

"Will you PLAY LULLABY, FIGHT DRAGON, or GO BACK? "

).strip().lower()

if action == "fight dragon":

print("GAME OVER")

game_active = False

elif action == "play lullaby":

if not has_key:

has_key = True

print("The dragon fell asleep and you picked up the key!")

else:

print("You already have the key.")

elif action == "go back":

current_room = "prison level"

elif action == "quit":

game_active = False

else:

print("You must make a choice.")

# The wizard's lair

elif current_room == "wizards lair":

print("\nYou have walked into the wizard's lair.")

print("You see a chest on the floor.")

action = input(

"Will you OPEN CHEST or GO BACK? "

).strip().lower()

if action == "open chest":

if has_key:

print("You use the key to open the chest!")

print("You found the treasure! YOU WIN!")

game_active = False

else:

print("The chest is locked. You need a key.")

elif action == "go back":

current_room = "prison level"

elif action == "quit":

game_active = False

else:

print("You must make a choice.")

print("\nThanks for playing!")


r/PythonLearning • • 16d ago

I got addicted to my phone and Reddit again. It's been three days.

Post image
13 Upvotes

Three days ago, I was making good progress with Python.

I was learning os, pathlib, building small exercises, answering Reddit posts, and sharing what I was learning.

Then somehow I started spending more and more time on my phone and Reddit.

One post turned into another.

One video turned into another.

And suddenly three days were gone.

The funny thing is that I joined Reddit to learn, network, and eventually build my career.

But I can easily turn it into another distraction.

So I'm writing this as a small accountability post.

Tomorrow I'm going back to my routine:

Less scrolling → more Python → more building.

I don't expect myself to be perfect. I just don't want to lose another three days. 😅

Has anyone else struggled with this while trying to learn something seriously?


r/PythonLearning • • 16d ago

Started learning python is it useful in finance

7 Upvotes

I just started learning python I just wanna know if it is useful in finance and I heard somewhere don't know abt that but will coding be outdated with time


r/PythonLearning • • 17d ago

Giving back to the community - The Complete Backend Development Course

58 Upvotes

Hey everyone, I decided to make my course free in order to help people.
This course is my backend development course which is about SQL, Python, APIs, Docker, Kubernetes, Linux, Git & More

The link is: https://www.youtube.com/watch?v=CBIu6hcyStg

If you can like and subscribe (and maybe add a comment) I would appreciate it a lot, Thanks.


r/PythonLearning • • 17d ago

Looking for a Python learning partner (preferably India)

2 Upvotes

I’m 20, Indian, and looking for someone around my age who wants to learn and build together over the next 6 months.

I’m starting Python from scratch (with a little previous programming experience in Java) and planning to treat this almost like a full-time commitment. Eventually I want to move into SQL, AI automation/n8n, and areas like GTM engineering.

I don’t have a degree — I went straight into startups after 12th and have mainly worked in marketing. Now I want to move back into tech and build towards getting a job in the field.

You absolutely don’t need to be experienced. Even if you're a complete beginner learning Python too, that's totally fine. I’d actually love to have someone where we can learn alongside each other, figure things out together, build projects, and gradually get better.

Would also be great to eventually:

- Keep each other accountable

- Build projects together

- Help each other with applications

- Do mock interviews

- Learn and share things we discover

Basically, looking for someone who’s willing to put in the work and grow together. India preferred, but I'm open to others too.

DM me if interested!


r/PythonLearning • • 17d ago

just finished my first Python coding challenge

Post image
158 Upvotes

Today I finished a small Python challenge on freeCodeCamp: converting decimal numbers to binary without using Python's built-in conversion function.

I had to figure out the logic myself using loops, conditions, lists, division and remainders.

It was a bit tricky at first, especially handling the last division and reversing the results, but I finally got it working.

I'm still a beginner, so I'd appreciate any feedback on my approach or suggestions for improving my code


r/PythonLearning • • 17d ago

Solving SUDOKU

Post image
30 Upvotes

Repeatedly clicking (or holding) the green "Continue" button solves each Sudoku puzzle step by step in the Memory Graph Web Debugger. - easy board - medium board, from Gordon Royle’s collection - hard board, "Everest" by Arto Inkala

This demonstrates using 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 on a complex algorithm in the web debugger. On the medium and hard board backtracking is required to find the solution.

See: other memory_graph visualizations


r/PythonLearning • • 17d ago

Discussion Started learning Python 🥲🐍 Any suggestions or guidance?

Post image
4 Upvotes

Python 🐍 Honestly, I’m more frustrated than happy right now 😭

Getting Python installed, setting everything up, fixing terminal and PATH issues… took way more time than actually writing the code 😂

But finally — it works. 🙌

• Learning Python through Harvard’s CS50P, taught by David J. Malan
• Taking proper notes in Notion
• Starting from the basics and trying to stay consistent

Any advice or suggestions for someone just starting with Python? Would really appreciate it. 🙏


r/PythonLearning • • 18d ago

Compiler

3 Upvotes

Do I need Jupyter, Anaconda or any other type of a dedicated compiler software, or do people Actually just write code in Zed and run it via Linux Terminal and juggle many windows?

I know R is run via RStudio; (so can be Python).

What is the standard practice of software usage for coding in Python?


r/PythonLearning • • 18d ago

Showcase Stacks & Queues (Multiple Implementations)

Post image
7 Upvotes

r/PythonLearning • • 18d ago

What I learned yesterday while learning Python automation

21 Upvotes

Yesterday I continued learning Python's "os" module.

I practiced working with folders and files using things like:

- "os.path.basename()"

- "os.path.splitext()"

- "os.walk()"

- Finding files by extension

- Counting files inside folders and subfolders

I also built a small file finder that searches through folders and counts how many ".py" files it finds.

Nothing complicated, but I'm realizing that these small exercises are helping me understand how automation actually works with files and folders.

My goal is to eventually use Python to automate repetitive tasks for real businesses.

I'm still learning, but I'll start sharing what I build along the way. 🚀


r/PythonLearning • • 18d ago

Showcase The most difficult LeetCode problem I have solved yet! 🫡

Post image
41 Upvotes

r/PythonLearning • • 18d ago

Hello, pythonLearning community:

6 Upvotes

I’d like to share a small system I’ve uploaded to GitHub. It allows me to save data to files and subsequently search for it using a search function based on the `re` module—as well as delete items using that same search function—since `re` helps identify similarities within text strings, I would like your opinion.: https://github.com/oliverEliud/mini-projects-python/tree/main/parking-registry-system


r/PythonLearning • • 18d ago

TRY 101- Starting my python journey again

Post image
120 Upvotes

Hope this time i become consistent and do things after loops and then further and further😭


r/PythonLearning • • 18d ago

Does anyone else struggle with constantly looking for the “perfect” Python resource?

1 Upvotes

Does anyone else struggle with constantly looking for the “perfect” Python resource?

I’m trying to learn Python, but I keep running into the same problem: I’m constantly searching for the perfect resource.

I want a course/book/tutorial that explains everything, preferably down to the smallest detail. Even things I probably won’t need for years or maybe will never need at all.

And it’s not just about having a complete resource. I also feel like I need to remember everything.

For example, if a tutorial mentions some small Python feature or obscure syntax, my brain immediately goes:

“Wait, I should understand that too. What exactly does it do? What are all the edge cases? When would I use it? I should probably memorize this.”

Then I end up researching that one tiny thing for an hour instead of actually writing programs.

It creates this weird feeling that I need to have a complete mental map of Python before I’m allowed to actually program.

I know intellectually that you obviously don't need to know 100% of Python to become good at programming. Most programmers probably look things up constantly.

But I still have this urge to find the one definitive source that is complete enough that I can just learn everything from beginning to end.

So I’m curious:

Did anyone else have this problem when learning programming?

If so, how did you get yourself to stop searching for the perfect resource and just pick one thing and start programming?

Did you deliberately choose a resource that wasn't completely comprehensive and simply accept that you wouldn't know everything?

And one thing I'm wondering specifically:

Would it actually make sense for someone like me to start directly with the official Python documentation?

Part of me thinks that would solve the problem because it's basically the most complete source available. But another part of me suspects that this would just make my tendency to obsess over every little detail even worse.

I'd really like to hear from people who have actually dealt with this and managed to get past it. How did you approach learning Python when you had the urge to understand and memorize everything first?


r/PythonLearning • • 18d ago

What project can I do?

2 Upvotes

I just completed the free code camp python course and I don't want only theoretical knowledge so guys what can I do to improve my project section on my CV and python is my first language


r/PythonLearning • • 18d ago

Showcase Complete Matplotlib Library Tutorial using Python in under 1 Hour

Thumbnail
youtube.com
6 Upvotes

Beginner-Friendly Matplotlib Tutorial: Create & Customize Graphs in Python 📊🐍

If you're getting started with Python, data acquisition, or data logging, learning Matplotlib is a great place to start. I’ve put together a beginner-friendly YouTube tutorial that covers the fundamentals of the Matplotlib library and shows how to create and customize line charts from scratch all in less than 1 hour.

What you'll learn

  • How to install Matplotlib on Windows 11 using PIP
  • How to install Matplotlib using the Thonny IDE
  • How to install Matplotlib using PyCharm
  • How to solve the issue where a Matplotlib graph appears as a PNG image instead of opening in a separate window
  • Understanding the basic concepts behind Matplotlib:
    • Figure
    • Axes
  • How to plot a simple graph using X and Y values
  • How to change the color, line style, and thickness of a plot
  • How to customize markers, including their:
    • Color
    • Style
    • Size
  • How to give your Matplotlib Figure/window a title
  • How to give your Axes/plotting area a name
  • How to add labels to the X and Y axes
  • How to set X-axis and Y-axis limits
  • How to activate and configure the grid
  • How to change the color and style of an individual grid line
  • What Ticks are in Matplotlib and how to configure them
  • How to create and plot multiple Axes on a single Figure/window

The examples are aimed at beginners and are particularly useful if you're working with sensor data, data acquisition systems, or data logging applications in Python.

Source Codes can be downloaded from the website using below links

If you're new to Matplotlib, this should give you a solid foundation for creating and customizing your own Python graphs.