The Ultimate 25 Minute Python Project!

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 111

  • @benjohnston3369
    @benjohnston3369 Рік тому +67

    As a beginner, some of this goes over my head, but the language is slowly starting to make sense thanks to your videos! Thanks for making them.

  • @y66-s3m
    @y66-s3m Рік тому +15

    Life is crazy, i first started watching your python tutorials when i was 15 back when you didn’t even show your face, fast forward 5 years later i got into CS because of you.. now being in my third year of uni and i still come back to your channel for help. You don’t know me but I have a lot to thank you for😭

  • @CMT-p6q
    @CMT-p6q Рік тому +5

    This project is rich with logic and algo that are used to solve interview questions. Highly recommend watching more then once.

  • @joannatrafna164
    @joannatrafna164 Рік тому +5

    hey Tim, I am a data analyst struggling with Python but your videos helped me so much to understand how Python works! Thank you so much for sharing! You are a brill teacher!

  • @adityabhambhani207
    @adityabhambhani207 Рік тому +2

    you're a legend Tim! what a fun experience i had while doing this...there really is an elegance about programming and oh boy do i love it!

  • @vedantsgoodlife7302
    @vedantsgoodlife7302 Рік тому +8

    This is a good way to learn. Please keep posting such videos.

  • @AliAliOxenFree
    @AliAliOxenFree Рік тому +3

    man you did a fantastic job in this video describing a situation that is difficult to describe (but is not exceedingly complicated, logic wise). You're a talented teacher!

  • @Abdulla_tech
    @Abdulla_tech Рік тому +1

    Since building the space invaders game with you 3 months ago and understanding nothing, I now understanding 90% of whats going on here and feel so proud. Thanks Tim!

  • @seyu8666
    @seyu8666 Рік тому +2

    Thank you so much for this. As someone who knows python but never really kind of mastered it this is really helpful in regaining the confidence in my learnings. Please make more of such projects

  • @mathewhunter7826
    @mathewhunter7826 Рік тому +2

    Hi Tim. Another solid video and project. I liked it so much and also tried a different way to write the program. I used a binary np array to code the color/position of a guess/target. Then used some mathematical functions to calculate correct/incorrect values. One of the things I really like about coding is the idea that there are many ways to write/solve a problem. With your videos I am learning to write to the point that I can explore different ways. Although, they are not very clean. With time they will be. Thanks for another great video! Looking forward to more!

  • @manjultripathi8309
    @manjultripathi8309 Рік тому

    Thanks

  • @alimihakeem841
    @alimihakeem841 Рік тому +2

    Thanks so much Tim for all the beneficial videos. Have really learn alot from it.

  • @bombus1340
    @bombus1340 Рік тому +5

    I replicated the code exactly (exept for using letters A-F instead of colours) and ran into a bug. After checking the correct positions, the second for-loop doesn't know which letters of the guessed code have already been used to find correct positions. Therefore the second loop goes over all letters in the guessed code again and compares them to the remaining actual code letters in the counts dict. If one of the remaining letters is identical to one of the guessed letters in the correct position, it uses that letter again for the incorrect position. Here is an example, because I think my description sucks: If the correct code is ECCD and you guess ECFD, the game prints 3 correct guesses and 1 incorrect guess (which doesn't make any sense). A workaround is to add "if guess_color != real_code" into the if-condition of the second for-loop. I hope this makes some sense lol

  • @bzwiv
    @bzwiv Рік тому +3

    Thanks Tim, this content is always useful.

  • @ithinkthereforeitalk935
    @ithinkthereforeitalk935 Рік тому +2

    Totally digging your new look. Brutal-looking bro with a beard. Yep, you gotta grow a pair, gotta toughen up , gotta hold your ground against ubiquitous Chat Gpt :).

    • @TechWithTim
      @TechWithTim  Рік тому +1

      lmao, exactly why i grew it out ;)

  • @alex_sea_lad
    @alex_sea_lad Рік тому +1

    I love you Tim from Tech with Tim

  • @murphygreen8484
    @murphygreen8484 Рік тому +1

    I love these videos, and this is very beginner friendly, but so much of this seems to be done much more difficultly than it needed to be

    • @murphygreen8484
      @murphygreen8484 Рік тому

      I can share my equally beginner code if interested?

  • @ehsanulhaqueraiyan8681
    @ehsanulhaqueraiyan8681 Рік тому

    I’m liking this type short project video because it is more enjoyable to learn programming with projects. hope u will bring more

  • @adventuresofavalon2477
    @adventuresofavalon2477 Рік тому +7

    Love such projects like this! Keep them coming

  • @ayatr26
    @ayatr26 Рік тому

    Thanks, you helped me break down this problem for my students. Really appreciate it!

  • @hussnainkhan900
    @hussnainkhan900 Рік тому

    I really enjoy your projects. You are such a blessing for Beginners. I really enjoy your vides so much. I just want to say : THANK YOU SO MUCH FOR SUCH A GREAT CONTENT.

  • @mangeurdecowan
    @mangeurdecowan Рік тому

    I never knew "else" could be used with a "for" loop. Nice!!

  • @hassanarjmandnia
    @hassanarjmandnia Рік тому

    that was a very very good video, thank u for making all of this awesome video.
    i hope u make more and more of this python projects video ( especially for intermediate level ) because they are very helpful.
    tnx again tim.

  • @andrewtsegaye7330
    @andrewtsegaye7330 Рік тому +1

    Is there anyone that competes with you with python? For me, you're the only one on this planet!

    • @ChupoCro
      @ChupoCro Рік тому

      Are you by "competes" referring to "the ability to explain Python in an understandable and comprehensive way" or to "the ability to write very complicated Pyhon code not everyone could write"?

    • @andrewtsegaye7330
      @andrewtsegaye7330 Рік тому +1

      @@ChupoCro Tim is python master! I'm sure that he come back with mind-blowing AI apps like chat-GPT

    • @ChupoCro
      @ChupoCro Рік тому

      ​@@andrewtsegaye7330 ​ I didn't say he isn't. But how could such a claim be based on watching the tutorials targeting beginners? For example, how could you tell Einstein is a top scientist afer watching him giving lectures to elementary school students? The other thing I implied is wether you examined some *really* complicated program code. You may take a look at Laplace Transform routines, understanding FFT algorithm, removing echo from sound routines, combining of accelerometer and gyroscope readings in PID loops used in quadcopters (take a look at Betaflight firmware) and similar. Of course, I am talking about programming all these from scratch and optimising the code for special purposes, not simply using some libraries. Or you may take a look at *capture the flag* problems involving Python.

    • @andrewtsegaye7330
      @andrewtsegaye7330 Рік тому

      @@ChupoCro I have worked with him for years nowadays.

  • @RedFox-ew8ek
    @RedFox-ew8ek Рік тому +1

    Hey Tim, your tutorials is very wonderful, comprehensive and realistic to a beginner like me, thank you for sharing your knowledge to us.. god bless..

  • @jimrobinson1963
    @jimrobinson1963 Рік тому

    Great set of videos, thanks Tim.

  • @fichtensaft5149
    @fichtensaft5149 Рік тому +5

    You’re starting to look like Walter White
    Keep it up, it’s amazing
    Now let’s watch the video

  • @DVD-Y2112
    @DVD-Y2112 Рік тому

    cool example, well explained!

  • @kapibara2440
    @kapibara2440 2 місяці тому

    Very interesting project🎉 thank you.

  • @erfanali3441
    @erfanali3441 Рік тому

    hey guys, someone can help me? i wrote this game with Tim step by step but mine is not running properly it just ask me to enter colors and then says that you must enter 4 color. and it continues like this. can you please help me? i checked my codes and it was exactly like him.

  • @harishsanthosh3861
    @harishsanthosh3861 Рік тому

    You are amazing my python skills are grow with yoy thank you bro❤

  • @felanfelani9117
    @felanfelani9117 Рік тому +1

    Hi, I think it wasn't required to use zip at line 49. Instead, it could have been done with a simple for loop.

  • @Naonowi
    @Naonowi Рік тому

    Great tutorial!!!
    I'm just wondering if there is a way to split the users guesses with the space separator AND if there isn't any space, split by spelling.
    I've found something like ◽guess = [*guess] ◽but I can't find a way how to make it work with .split(" ")

  • @rattlin9194
    @rattlin9194 Місяць тому

    Somebody please stop me losing my mind.. In lines 34, 39 and elsewhere after; 'real_code' is referenced as a parameter but I have no clue what it's representing.
    Presumably in line 39 'color' is looping through real_code, but what/where is that!? 😲
    At 13:34 I just need a follow up with Why, we 'say' 'real_code'
    I know it's daft but at this stage, I think (am hoping) a mistake was made, whereby 'real_code' meant to read 'code' (as was generated up at the start). If so it would make sense to me. Otherwise, what are we iterating over, exactly?
    Thanks in advance to anybody!

  • @MarElNij
    @MarElNij Рік тому +1

    Can you make a video about how to 'upgrade' this program? Mabye by making a function to show which color is correct, incorrect or not used. Like the real game....

  • @OnixEdge
    @OnixEdge Рік тому +1

    I couldn't find the code for this in your github. I'm struggling with functionality and would like to see the source code to compare.

  • @landonhutchinson2697
    @landonhutchinson2697 11 місяців тому

    I would like to add levels to this and each time the length increases. What would be the best way to do that? Make modules?

  • @mariumbegum7325
    @mariumbegum7325 Рік тому

    Very useful content, great work!

  • @user-xw5lh6rv7e
    @user-xw5lh6rv7e Рік тому

    I hope this message finds you well. I wanted to take a moment to express my deep gratitude for your invaluable contribution to the project. Your efforts have been instrumental in its success, and I am truly grateful for your dedication and hard work.
    I wanted to let you know that the project has been completed, and it wouldn't have been possible without your expertise and support. Your guidance and input throughout the process have been invaluable, and I am truly grateful for your contributions.

  • @elahekhatoonabadi7402
    @elahekhatoonabadi7402 Рік тому

    It’s awesome .thank you

  • @paulthomas1052
    @paulthomas1052 Рік тому

    Great project - Thanks.

  • @natsukeru
    @natsukeru Рік тому +1

    In the generate_code function, I would just write code.append(random.choice(COLORS)) instead of setting the random.choice to a variable then append the variable to code
    Is there a reason to do it in two lines instead of one? Is it a convention or just to make it easier to explain/change later?

    • @Hex-Scholar
      @Hex-Scholar Рік тому

      I used random.choices!

    • @Miggy97
      @Miggy97 Рік тому

      No difference at all, just helps with readability

  • @rayne6871
    @rayne6871 Рік тому

    Hey Tim, loved the video! Is there any way to add the curses module into this? I've been stuck on it for quite some time

  • @FURY_7_7
    @FURY_7_7 Рік тому

    Tim what is the name of your vscode theme in this video ?

  • @dylanyork5407
    @dylanyork5407 Рік тому

    I've learned what I know about python from you, so thank you for that. Is it possible you could do a tutorial for an rpg style text based adventure game in python?

  • @doomsdaymaximus
    @doomsdaymaximus 10 місяців тому

    Bro is responsible for me failing college but getting a job as a Py Dev lol

  • @TheM9s
    @TheM9s Рік тому

    So if you enter any incorrect format answer , EG OOOO, or O O OO, it infinitely loops, how can this be solved?

  • @andreazevedodesign
    @andreazevedodesign Рік тому

    Hello. Could you make an extension for inkscape, a simple one just for learning?

  • @dyndarkxy8294
    @dyndarkxy8294 Рік тому

    thank u very much this helped :)

  • @fondbcn42
    @fondbcn42 Рік тому

    why the last 'else' didn't raise an error ?

  • @leulwebshet9750
    @leulwebshet9750 Рік тому

    I saw this notification while watching your Greedy Algorithms Tutorial😊

  • @htune754
    @htune754 Рік тому +1

    im lost...how do you actually run the code. i debugged it. nothing wrong , but it wont actually run. do i need an extension?

    • @Goose____
      @Goose____ Рік тому

      you do need a python extention in vscode yes

  • @ramganeshwaranm2535
    @ramganeshwaranm2535 Рік тому

    very useful

  • @yessirski7868
    @yessirski7868 Рік тому

    I have been having some trouble with this for some reason. When I try to run it, it tells me the last line where the if __name__ == __main__ line is has an error because game( ) is not defined. any idea on how to fix this issue?

  • @kinghumbles6173
    @kinghumbles6173 Рік тому

    Have you made series of python from zero to hero?

  • @sanumpzha
    @sanumpzha Рік тому

    Nice video.👍

  • @nothanksjac
    @nothanksjac Рік тому

    did everything as shown but correct position wont show in return. Help?

  • @Mr.Nichols
    @Mr.Nichols Рік тому

    Fun innovative way to torture your prisoners as a Dev in Python!
    "Let me go, please!" "Yeah, sure let me just program this game real quick... and......... let's play."
    If they don't get the answer within 10 times..... they 🤐🤐

  • @mahmudunnabisiam
    @mahmudunnabisiam Рік тому

    Love you video following from a long time

  • @garybeckett4461
    @garybeckett4461 3 дні тому

    Great learning project .. where is source code pls😊

  • @marcinzale
    @marcinzale Рік тому

    Very good explanation

  • @manojitbiswas555
    @manojitbiswas555 Рік тому +2

    source code?

  • @dhruvmandala5128
    @dhruvmandala5128 Рік тому

    for me on line 44 it says guess is undefined

    • @ShrijaVadla
      @ShrijaVadla 6 місяців тому

      Same, did you solve that??

  • @ShrijaVadla
    @ShrijaVadla 6 місяців тому

    44 line, it says NoneType error

  • @infinitespace1982
    @infinitespace1982 Рік тому

    This is like wordle

  • @UnthinkableFairytales
    @UnthinkableFairytales Рік тому +1

    Got a bit confused coz I kept hearing "cutters" .. figured you were saying colors

  • @sadjiajfiarei3498
    @sadjiajfiarei3498 Рік тому

    can anyone give me a piece of advice. My code always works i tried to made this programm myself and i successfully made it but the problem is that my programm is shitty not professional at all

  • @minhamhussain2000
    @minhamhussain2000 Рік тому

    good sir

  • @odex_cod1030
    @odex_cod1030 Рік тому

    Bro have been watching u b4 u had a breard

  • @Simple_OG
    @Simple_OG Рік тому

    What is the name of your vs code theme

  • @faresmahmoud1305
    @faresmahmoud1305 Рік тому

    Hey man, loved the video keep up the good work. but I disliked the transitions for me it was too long.

  • @EmirKayaloglu
    @EmirKayaloglu Рік тому

    NİCE MAN

  • @Harshadswe123
    @Harshadswe123 Рік тому

    Make project videos with golang

  • @relytheone853
    @relytheone853 Рік тому

    I wish I have more knowledge to build the next big thing.

  • @learningonline3648
    @learningonline3648 Рік тому

    You can simply extend this to make Wordle!

  • @princesimfukwe9158
    @princesimfukwe9158 Рік тому

    Tim with beards kkkk

  • @ItzAngeI
    @ItzAngeI Рік тому

    the master of python creating the mastermind game

  • @ChupoCro
    @ChupoCro Рік тому

    Should be {TRIES} *tries* instead of just {TRIES}. 50+ comments and noone noticed?

  • @maigijs
    @maigijs Рік тому

    Little bit tweaks and it will become a word guessing game!

  • @buzzard777
    @buzzard777 Рік тому

    Nice video. Not important but for some reason I keep hearing you say "cuthers" instead of colors.

  • @pmcelraft
    @pmcelraft Рік тому +1

    Wait a minute this is false advertisement as the thumbnail has a graphical program

  • @mcpro7334
    @mcpro7334 Рік тому

    Hey

  • @Ursus_major37
    @Ursus_major37 Рік тому

    Pierwszy!

  • @baloney_sandwich
    @baloney_sandwich Рік тому

    Hold a second, this doesn’t even have a GUI, useless, good effort though

  • @mddawid0323
    @mddawid0323 Рік тому

    no one prefers python IDLE

  • @SubDogWater
    @SubDogWater Рік тому

    None of your projects ever worked for me.

  • @Hex-Scholar
    @Hex-Scholar Рік тому

    Hey Tim,
    Nice Project, a good warmup!
    For Generating the Code, we could:
    code = random.choices(COLORS, k= CODE_LENGTH) right ?

  • @kvelez
    @kvelez 7 місяців тому +1

    import random
    COLORS = ['R', 'G', 'B', 'Y', 'W', 'O']
    ATTEMPTS = 10
    LENGTH = 4
    def generate_code():
    code = []
    for _ in range(LENGTH):
    code.append(random.choice(COLORS))
    return code
    def guess_code():
    while True:
    guess = input('Enter your guess (e.g., R G B Y): ').upper().split()
    if len(guess) != LENGTH:
    print(f'Invalid guess. Please enter a {LENGTH}-color code.')
    continue
    for color in guess:
    if color not in COLORS:
    print(f'Invalid guess. Please use colors from {COLORS}.')
    break
    else:
    return guess
    def evaluate_guess(guess, code):
    color_counter = {}
    valid_position = 0
    invalid_position = 0
    for color in code:
    if color not in color_counter:
    color_counter[color] = 0
    color_counter[color] += 1

    # First pass: Count valid positions and decrease the counter
    for guess_color, real_color in zip(guess, code):
    if guess_color == real_color:
    valid_position += 1
    color_counter[real_color] -= 1

    # Second pass: Count invalid positions without counting already matched colors
    for guess_color, real_color in zip(guess, code):
    if guess_color != real_color and guess_color in color_counter and color_counter[guess_color] > 0:
    invalid_position += 1
    color_counter[guess_color] -= 1

    return valid_position, invalid_position
    def game():
    print(f"You have {ATTEMPTS} attempts to guess the {LENGTH}-color code.")
    print('The available colors are: ', ' '.join(COLORS))
    code = generate_code()
    for attempts in range(1, ATTEMPTS + 1):
    guess = guess_code()
    valid_position, invalid_position = evaluate_guess(guess, code)
    print(f'Valid position: {valid_position}. Invalid position: {invalid_position}.')
    if valid_position == LENGTH:
    print(f'You guessed the color code in {attempts} attempts!')
    return
    else:
    print('You ran out of attempts. The code was:', ' '.join(code))
    if __name__ == '__main__':
    game()

  • @claudiamanta1943
    @claudiamanta1943 8 місяців тому

    Is this how a hacker creates a simple program to guess a password?

  • @OriginalCoder.__
    @OriginalCoder.__ 8 місяців тому

    Hi everyone
    import random
    COLOR=['R','G','B','Y','O','W']
    tries=10
    code_length=4
    def generate_code():
    code=[]
    for _ in range(code_length):
    Color=random.choice(COLOR)
    code.append(Color)
    return code
    code=generate_code()
    print(code)
    for i in range(tries):
    correct_position=0
    incorrect_position=0
    user_code=input("Guess The code : ").upper()
    for j in range(len(user_code)):
    if user_code[j] not in code:
    pass
    # print("Correct Position ", correct_position,"|","Incorrect Position : ",incorrect_position)
    elif user_code[j] in code:
    # print("Yes")
    if user_code[j]==code[j]:
    correct_position+=1
    # incorrect_position=0
    else:
    incorrect_position+=1
    print("Correct Position ", correct_position,"|","Incorrect Position : ",incorrect_position)
    if correct_position==4:
    print("You guessed right!! in {} tries".format(i))
    break
    else :
    continue
    Can anybody please tell is this approach of my code correct or not?