The Ultimate 25 Minute Python Project!

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ค. 2024
  • Today, I'll be showing you a quick Python project that you can work on to hone and practice your skills, while learning some new Python features!
    💻 Start scanning your code with CodeSec by Contrast Security for free! bit.ly/3VLR0P0
    💻 Master Blockchain and Web 3.0 development today by using BlockchainExpert: algoexpert.io/blockchain - use code "tim" for a discount!
    💻 ProgrammingExpert is the best platform to learn how to code and become a software engineer as fast as possible! programmingexpert.io/tim - use code "tim" for a discount!
    ⭐️ Timestamps ⭐️
    00:00 | The Ultimate Python Project
    01:00 | Project Demo
    04:20 | Project Walkthrough
    27:28 | Running the Project!
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    👕 Merchandise: teespring.com/stores/tech-wit...
    📸 Instagram: / tech_with_tim
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-ruscica-82631b179
    🌎 Website: techwithtim.net
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    🎬 My TH-cam Gear: www.techwithtim.net/gear/
    💵 One-Time Donations: www.paypal.com/donate?hosted_...
    💰 Patreon: / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    - Tech With Tim
    - Python Development
    - Coding
    ⭐️ Hashtags ⭐️
    #techwithtim #developer #python #howtolearncoding

ความคิดเห็น • 107

  • @benjohnston3369
    @benjohnston3369 ปีที่แล้ว +63

    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.

  • @user-wz3zi3fv9y
    @user-wz3zi3fv9y ปีที่แล้ว +14

    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😭

  • @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!

  • @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!

  • @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

  • @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!

  • @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!

  • @alimihakeem841
    @alimihakeem841 ปีที่แล้ว +3

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

  • @CMT-p6q
    @CMT-p6q ปีที่แล้ว +4

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

  • @vedantsgoodlife7302
    @vedantsgoodlife7302 ปีที่แล้ว +8

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

  • @Abdulla_tech
    @Abdulla_tech ปีที่แล้ว

    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!

  • @bzwiv8021
    @bzwiv8021 ปีที่แล้ว +4

    Thanks Tim, this content is always useful.

  • @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.

  • @ayatr26
    @ayatr26 11 หลายเดือนก่อน

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

  • @ehsanulhaqueraiyan8681
    @ehsanulhaqueraiyan8681 11 หลายเดือนก่อน

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

  • @jimrobinson1963
    @jimrobinson1963 ปีที่แล้ว

    Great set of videos, thanks Tim.

  • @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

  • @hassanarjmandnia
    @hassanarjmandnia 10 หลายเดือนก่อน

    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.

  • @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?

  • @paulthomas1052
    @paulthomas1052 ปีที่แล้ว

    Great project - Thanks.

  • @mariumbegum7325
    @mariumbegum7325 ปีที่แล้ว

    Very useful content, great work!

  • @mangeurdecowan
    @mangeurdecowan ปีที่แล้ว

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

  • @harishsanthosh3861
    @harishsanthosh3861 ปีที่แล้ว

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

  • @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

  • @elahekhatoonabadi7402
    @elahekhatoonabadi7402 ปีที่แล้ว

    It’s awesome .thank you

  • @DVDY-ih8wi
    @DVDY-ih8wi 9 หลายเดือนก่อน

    cool example, well explained!

  • @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..

    • @TechWithTim
      @TechWithTim  ปีที่แล้ว +1

      No problem! Glad you liked it

  • @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 ;)

  • @adventuresofavalon2477
    @adventuresofavalon2477 ปีที่แล้ว +7

    Love such projects like this! Keep them coming

  • @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?

  • @alex_sea_lad
    @alex_sea_lad ปีที่แล้ว +1

    I love you Tim from Tech with Tim

  • @sanumpzha
    @sanumpzha ปีที่แล้ว

    Nice video.👍

  • @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....

  • @dyndarkxy8294
    @dyndarkxy8294 ปีที่แล้ว

    thank u very much this helped :)

  • @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.

  • @andreazevedodesign
    @andreazevedodesign ปีที่แล้ว

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

  • @landonhutchinson2697
    @landonhutchinson2697 6 หลายเดือนก่อน

    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?

  • @manjultripathi8309
    @manjultripathi8309 ปีที่แล้ว

    Thanks

  • @Milkamoki
    @Milkamoki ปีที่แล้ว

    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(" ")

  • @FURY_7_7
    @FURY_7_7 ปีที่แล้ว

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

  • @ramganeshwaranm2535
    @ramganeshwaranm2535 ปีที่แล้ว

    very useful

  • @TheM9s
    @TheM9s ปีที่แล้ว

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

  • @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?

  • @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.

  • @fondbcn42
    @fondbcn42 ปีที่แล้ว

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

  • @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.

  • @nothanksjac
    @nothanksjac 11 หลายเดือนก่อน

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

  • @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.

  • @leulwebshet9750
    @leulwebshet9750 ปีที่แล้ว

    I saw this notification while watching your Greedy Algorithms Tutorial😊

  • @fichtensaft5149
    @fichtensaft5149 ปีที่แล้ว +5

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

  • @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

  • @kinghumbles6173
    @kinghumbles6173 ปีที่แล้ว

    Have you made series of python from zero to hero?

  • @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

  • @user-xw5lh6rv7e
    @user-xw5lh6rv7e 8 หลายเดือนก่อน

    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.

  • @mahmudunnabisiam
    @mahmudunnabisiam ปีที่แล้ว

    Love you video following from a long time

  • @ShrijaVadla
    @ShrijaVadla 2 หลายเดือนก่อน

    44 line, it says NoneType error

  • @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

  • @minhamhussain2000
    @minhamhussain2000 ปีที่แล้ว

    good sir

  • @infinitespace1982
    @infinitespace1982 ปีที่แล้ว

    This is like wordle

  • @marcinzale
    @marcinzale ปีที่แล้ว

    Very good explanation

  • @naturesmusic1171
    @naturesmusic1171 ปีที่แล้ว +1

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

    • @TechWithTim
      @TechWithTim  ปีที่แล้ว +1

      I blame my Canadian accent

  • @Harshadswe123
    @Harshadswe123 ปีที่แล้ว

    Make project videos with golang

  • @odex_cod1030
    @odex_cod1030 ปีที่แล้ว

    Bro have been watching u b4 u had a breard

  • @learningonline3648
    @learningonline3648 ปีที่แล้ว

    You can simply extend this to make Wordle!

  • @Simple_OG
    @Simple_OG ปีที่แล้ว

    What is the name of your vs code theme

  • @dhruvmandala5128
    @dhruvmandala5128 11 หลายเดือนก่อน

    for me on line 44 it says guess is undefined

    • @ShrijaVadla
      @ShrijaVadla 2 หลายเดือนก่อน

      Same, did you solve that??

  • @relytheone853
    @relytheone853 7 หลายเดือนก่อน

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

  • @manojitbiswas555
    @manojitbiswas555 11 หลายเดือนก่อน +1

    source code?

  • @EmirKayaloglu
    @EmirKayaloglu 10 หลายเดือนก่อน

    NİCE MAN

  • @homieee_lander
    @homieee_lander 5 หลายเดือนก่อน

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

  • @faresmahmoud1305
    @faresmahmoud1305 ปีที่แล้ว

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

  • @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 🤐🤐

  • @princesimfukwe9158
    @princesimfukwe9158 ปีที่แล้ว

    Tim with beards kkkk

  • @pmcelraft
    @pmcelraft 10 หลายเดือนก่อน +1

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

  • @mcpro7334
    @mcpro7334 ปีที่แล้ว

    Hey

  • @ItzAngeI
    @ItzAngeI ปีที่แล้ว

    the master of python creating the mastermind game

  • @maigijs
    @maigijs ปีที่แล้ว

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

  • @claudiamanta1943
    @claudiamanta1943 4 หลายเดือนก่อน

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

  • @ChupoCro
    @ChupoCro ปีที่แล้ว

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

  • @buzzard777
    @buzzard777 10 หลายเดือนก่อน

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

  • @Ursus_major37
    @Ursus_major37 ปีที่แล้ว

    Pierwszy!

  • @mddawid0323
    @mddawid0323 ปีที่แล้ว

    no one prefers python IDLE

  • @baloney_sandwich
    @baloney_sandwich ปีที่แล้ว

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

  • @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 ?

  • @SubDogWater
    @SubDogWater ปีที่แล้ว

    None of your projects ever worked for me.

    • @TechWithTim
      @TechWithTim  ปีที่แล้ว

      What are u having issues with?

  • @kvelez
    @kvelez 2 หลายเดือนก่อน

    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()

  • @OriginalCoder.__
    @OriginalCoder.__ 4 หลายเดือนก่อน

    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?