3 Mini Python Projects - For Beginners
ฝัง
- เผยแพร่เมื่อ 5 มิ.ย. 2024
- If you're a beginner or intermediate programmer seeking short, fun, and interesting projects to work on, then here are 3 Unique Python Projects to work on! You'll see me code completely from scratch, break down the problem (my thought process), come up with a solution, and fix any problems and/or bugs.
Code In This Video: github.com/techwithtim/3-Mini...
💻 Master Blockchain and Web 3.0 development today by using BlockchainExpert: 🔗 algoexpert.io/blockchain (Use code "tim" for a discount!)
💻 Accelerate your software engineering career with ProgrammingExpert: 🔗 programmingexpert.io/tim (Use code "tim" for a discount!)
🎬 Timestamps ⏱️
00:00 | Video Overview
01:11 | Environment Setup
02:00 | Programming Expert
02:22 | Project #1 - Pig
23:48 | Project #2 - Madlibs Generator
39:42 | Project #3 - Timed Math Challenge
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
👕 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
One-Time Donations: 💲 www.paypal.com/donate?hosted_...
Patreon: 💲 / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
-Tech with Tim
-Python
-Coding for Beginners
⭐️ Hashtags ⭐️
#techwithtim #programming #python
The three essential elements for coding success: pizza, coffee, and a solid collection of Stack Overflow bookmarks!😂
And ChatGPT 4.0 for when lazy/hungover
Just wanted to say how awesome and easy to follow your tutorials are! I watched this and your intermediate project tutorial, and they're brilliant. Thank you!
Yet another great tutorial! Digesting it all, and then will code along with you, to make sure it all sinks in.
There's something about the way you teach, and explain each step, which really makes it clear. Will have to check out your course 😉
Appreciate all the work you put into your videos, and the amount of free content you provide. Excited to watch and learn more!
just got back into coding and i came across your channel and i must say i love the way you teach! Thank you for being so thorough and beginner friendly :)
00:01 Learn to code 3 unique Python projects from scratch
01:43 Project 1: Pig - A multiplayer game where players roll dice and accumulate scores.
05:20 Generating a random role for a game
07:13 Checking for valid number input and breaking out of the loop
11:03 Using underscores for variable names and looping through player scores.
12:57 Checking and converting input for rolling the dice.
16:52 Implementing the logic for simulating turns and calculating scores for players.
18:30 Simulating the game progress and determining winner
21:50 Finding the maximum score and the winning player
23:41 Creating a Mad Libs generator
26:49 Using open function to read a file in Python.
28:28 Replace all instances of a given word in a string with user input.
31:52 Using sets to find unique words and creating a dictionary for word values
33:34 Using dictionary to store and access key-value pairs
37:11 Using Python to replace words in a story
39:16 Project three involves generating random math questions and timing how long it takes users to answer them.
42:38 Using eval function to dynamically calculate the answer
44:34 Showing how to use the eval function in Python to evaluate expressions.
48:08 Implementing a timer and tracking correct answers in Python.
49:48 Introducing a timer function for user input.
53:25 Coding practices and availability of code
I just got a job as a python instructor in high school because of your videos, didn't know any python beforehand!
thank you so much
bro you literally the best teacher of python. Ive look at other videos and they either too long or saying something that out of topic i like how you go straight to the point
That was great Tim, many thanks. I've watched a few Python tutorials already, but I still managed to pick up a few valuable tips. Python continues to surprise me with how simply and efficiently it's possible to write a normally 'code-consuming' process in just a couple of steps. One great tip was
player_scores = [0 for _ in range(players)]
I didn't know that a for loop was allowed to be used to build a list in that way.
Thanks again for your help, expertise and generosity.
At 11:27, you can also write player_scores = [0] * players;
And you could have made it harder to accidentally make the mistake of the extra len call with better naming: name the variable player_count rather than players.
Also, you might want to extract a play_turn function that plays the entire turn and returns the score for that turn.
that's exactly what i did i made 3 functions a roll function and a func that get the turn of the player and a fucntion that get the valid player count
I had just completed all 3 projects. Thanks for this great practical tutorial.
also theres a little bypass in the pig project, if you type no for the number of players then type a number that should be invalid it will count it as valid, to fix this just put "from asyncore import loop" in the start of the code and put "if players > 4:" after the "print("Must be between 2 - 4 players.")" and then after the "if players > 4:" put "print("Invalid, must be below or equal to 4")" then below this put "loop" , sorry if i made this confusing but thought i would just add that.
Another great tutorial. Programming that Pig game was fun. I needed to practice my Classes so I created a class for each player. I even took the pig a step further and created a Hog variant and ask the user which one they want to play.
How did you make the classes?
a hog variant?
@@Jay-pe4gxhog is variant of pig
@@josecintron85 how does it work
Great video! Your explanation of Python is really helpful. Can you please make a video on how to send a single message to a group of people at once using Python? Thanks in advance for your amazing content
What a great content you are producing Tim! Kudos ❤
What a great content ❤ Ivam getting more and more captivated by these tutorials Tim. Thank you 😊
This is great. thanks Tim!
I love coding Python especially that I am an intermediate Python coding skill. I would love to follow some tutorial and projects in Python with you! Oh yeah, I already liked your video. Thank you so much for teaching me something new today, I appreciate it!
Hey Tim! Great video as always! Something that caught my attention though was toward the end of the pig game where you're displaying the winning player number. You use the max() function to get the high score from the array, but then you use the index() function to get the player number. Wouldn't this cause a bug when there's a tie? (Not that the program would crash but that it would display incorrect information about the winning condition.)
Either way, great job again!
Good point that could potentially cause a bug! Nice catcg
I really liked your 3rd project Tim. Thanks.
Thanks for your hard work Tim really appreciate it as a teenage beginner
I had a lot of fun building all three projects
Just finished a python practical course and wanted to test my skills. This video was an eye opener for several of problem solving skills needed for any job, gotta say everyone have to at least try to attempt these by themselves and make improvements on the already existing block of code.
Thankyou so very much!!
You mentioned a practical course.... PLEASE! do you know where i can also sign up for that.
Use the F-String it is better than the plus operator.
A clear and easy-to-follow tutorial. Exactly what I was looking for. Thank you so much for your videos
Great trio of Python classes. Thanks Tim !
Sehr Gut! Danke 💚
For anyone having an issue with "value = roll()" try: value = roll(min_value=(), max_value=())
thanks for making this videos !! do more beginner and intermediate projects whenever you have the chance
Thank You sir!
I really enjoyed and learn a lot 🙏
Love your tuts Tim. Quick question, is keeping track of start_of_word with -1 needed? It doesn't seem to actually be doing anything outside of itself since we are using i to get start and end of word. I tried removing it and it still seems to work but maybe I missed something? thx
I'm having so much fun thank you :)
תודה אח יקר
Great Tutorial!!!
Who dreams to become like tim
I do
Me of course
Always was my dream
This is a great content, will you be able to show a mini project from start to end. Something like how you get the data, how you code and how you create API and how you deploy. Thanks
Hi Tim, I want to ask something. I'm a bit new to software. What I was wondering is, we made a game with python in project-1. So, can we use these codes on a mobile application or a game website? Or is it necessary to use a language other than python for these? (By the way, can you code such a small game for mobile? I'm very curious how the process is with the UI and deploy processes.)
really interesting content, many thanks!
The Programming Expert videos are like these tutorials on steroids!!!! It took me a long time to bite bullet but its well worth the price ( caught a sweet deal and bought the entire package) !
So glad you’re enjoying it!
Thankyou I got it at the right time
I'm a python n00b! not afraid to admit it :p I have some good bash scripting experience, and some JS / php, and am loving python so much! thx for this cool video. i really like your teaching style!
Rather than using eval could you also use an if statement or some other function and then just do left operator right to get ans? Eval opens up some vulnerabilities but i suppose for a project like this it's fine.
Great video though
Thank you for your video!!
New here. I find this content absorbable and enjoyable. I like the direct approach to learn some basics.
Hi Tim, I just wanted to say that Im really starting to enjoy these mini project videos. if it isn't to much of a hassle, I believe that you should also try and continue the building games in an hour series. anyways, keep up the good work and thank you for the tutorials
Hello can we work on projects together ?
Thanks for your video, the explaination is great. I started with the first project, I think it is a good example to get into coding and loops.
However, I am sorry if I am wrong with this but I think the code does not work as you intend it to.
If your score gets over 50, you can continue rolling as long as you like.
The reason this does not show up in your testing is that 50 is a very high number and there is almost always either a 2 being rolled or the player terminating before reaching this point.
When you set the max_score down to 15 you will see that the termination does not work. This makes sense as the termination happens outside the for-loop and the for-loop will let you dice as long as you dont roll a 1 or terminate yourself.
I now adjusted the code, you need another if statement for exiting when score > 50
Hey TimWithTech ive wathec a coupple of viedos and id love to learn more about webdevelopment using django in python. love all ur vids, greet explainations!
Thanks for this video! I'm a beginner.
Great tutorial thanks.
Just one question if we wanted to make the curent_score zero and not store the score from the previous turn when we role 1 after few turns what can we change?
Great Video Tim
Excellent approach 👍
Glad it was helpful!
Thank you~
When I made the pig game I only used one while loop and implemented a series of if-else statements. Out of curiosity which is the better coding practice?
It's shoulders Tim today lads
Some beautiful mini projects to get the vibe and gist of how one needs to think to code.
print("Thanks Tim!")
Hey time in 32:55 i saw a way of removing duplicates and keeping the order without the use of sets and i did this
unique_words = list(dict.fromkeys(words).keys())
print(unique_words)
i created a new list called "unique_words" and changed that into a dictionary and obvs a dictionary has only one unique key value so it removes the duplicates and i retrieved the keys using the key methodes then i changed back to a list
Hello Tim , ur advice plz what you encourage me to copy the code when I watch the video or watch a part of it and try to make the same project . Or watch the full video and Try to make the same project and when I suffer alot I rewatch it
Thanks alot 🥰
Tried project 1 before watching the steps and I ended up writing a code that was more than 200 lines long then I came to see your solution and it was only 50 to 60 lines long lol. And yours was even cleaner except I added the option to play against computer to it
hello Mr Tim this video is great thanks for the nice work
first python project that i made that does something! yay!!
Hey, Great tutorials. keep up the good work. but i have found a mistake in the dice game: If i run my code the "Do you want to roll (y) ?" doesnt work and i am in an endless loop
hey Tim your tutorials have helped me and my buddies thank you so much
Great to hear!
Thank you
"Bear and tim live happily ever after" made me burst out of laugh....BTW thanks for ur tutorial.
My question is, how do you remember and keep a track of SOOO many variables you create while writing the code ???
you dont...its just a mental game...
it helps if you name them logically then its more similar to english when you're writing the code making it easier to comprehend
Wow your a great coder thank you for this video
thx a lot mister genius
Actually for the madlibs generator a faster way to do it would be to use a formatted string to insert the words in
For the Pig game, I do not understand how the while loop for the player number 2 turn can run when the loop has already exited.
When the initial max score (which is 50) has been reached, we *break out* of the while loop.
So how can the player number 2 turn can still run when it is in the while loop?
Please explain, I'm lost.
Hi, thanks for the video. What is that program being used?
Bro, if we do it again again means
The current score will add to players score if the players will completed the game means the players score will store the value of the previous game why the game is starting again it doesn't ask any question " how many players want play"
And also why the players score will store the new value once user finished the game ?
Real learning is
if students give you a task they've seen before,
and how actual skilled expirienced teacher handles with it LIVE(!),
not task prepared by himself, explaining all his thoughts at every step
Fair enough, what task would u like me to do?
@@TechWithTim just a thought. It would be nice to see something on - i don't know - 3 or 4 different levels? Something like an RPS Character generator, first in a very simple, beginner level, like add a name, age, race, some basic stats. Then in a next video or just next part add some more complex functions, like saving/loading/deleting a character, selecting some traits than can affect the basic stats, and on a "higher" level some more (idk tbh im way too beginner to come up with something reasonable). It's just one iteration, but the basic idea is to have the same project and work it out as you progress with python. - Btw thank you very much for the video. I was struggling with some loooong tutorials presenting all what you can do with python without context. This and the older mini project video helped a lot to have a basic understanding about what these elements do in practice.
It works well enough, even if your idea is solid you sound jealous :P
Hello Tim, I just Wanted to know that when is the code jam happening, i am interested to join. Thanks.
bro, you are the best. Please do more of beginners projects. Thanks.
Thanks
im honestly kinda confused. the commands are kinda diffrent , i use "thonny" and like commands u show in the video are diffrent & dont work? "import random" is "from random import*" for example. this is like the only thing i managed to figure out the rest god knows what they are. can u link a list that like translates the commands.? i know python has versions that might change the prefixes & like "names" of certain commands so is there a way to check that or sum?
Just started coding, heard it might be useful in the future, but I did the pig game tutorial and it isn't working. So I opened up the github link, and copied the code into the venv, and it wouldn't work. I'm using pycharm. Any ideas?
It's going to be a long shot since this is already an old video, but I am struggling with the first project and would love to have some help. I think my issue comes from around line 26 to 29.
I have written exactly the same as him, however when I run the game I get "player number 1 turn has just started" + "player number 2 turn has just started." So for some reason my text keeps on giving me both player number instead of just saying "player number 1 turn has just started." Does anyone know how to change this issue ?
Can you please update your django course with pycharm?
very good
Great! 😁
for project 3, the math game, does anyone know how to make the game continue after an incorrect guess? it repeats the question over and over until you get it right, but i want it to continue and stop at 10 and calculate percentage of accuracy after that
I appreciate the crash course. I am more familiar with running and testing code so please forgive me for being a noob. I literally go tripped up on step 1 project 1. When you import the random module how do you get this into your python ide? I am using vs and I checked the extention hub but it was not clear what I should install if this is even the correct place to install random from. Please lend some advice. Thanks!
I answered my own question. I needed to specify this was a python file.
Tim, thank you for this. Just finished the first project. Why all the extra work for the roll function, though? I don't understand your thinking making min and max variables.
Just to make it extremely clear when reading the code!
@@TechWithTim Nice
When i import the story.txt, it doesnt show up. How would i put it in the same directory?
can somone help me on the madlibs it keeps saying "str " object has no attribute "add"
In project 2, it keeps on dallsayinh story is not defined but i checked and story text file is in the same folder i dont understand anyone help
what if I want to print my players by their names?I have been struggling with this. thank you for the awesome projects
I guess: use player_idx as an index to get a name, ex player 1 would be index 1 that would mean the second name in a list, so varable = ["no player",Jon,Bob,Ragnar]
player 1 Jon, Im a noob so i guess someone could type a better solution, but this is my estimat of how it would work in a way.
On the Pig one, when it runs it just keeps asking Would you like to roll?, over and over again until you type something other than y, then it displays the score and moves to the next player. In your video it asks once and then displays your score each time. I’ve looked through and I’m not sure what I’ve done wrong, how can I fix it?
You are missing a break either on the while that controls if the player wants to continue rolling or in the if that controls if the player rolls a 1
If I want to add countdown timer for 10 questions Then how can I do that. Example I want to finish quiz in 20 seconds or else timed out then how to do please help me
Use stopwatch
I am having trouble with Visual Studio Code not updating the code I'm running even though my .py file has been updated.
I tried the first project,I completely stick that code only , but I got maximum score of 73 as output, the maximum score is 50 only why it comes like that?
i just want to know y the (wrong=0) and (wrong+=1) used here , without using also the code executes as usual, can anyone help me ?
At the start of my game. It’s saying that all players have started instead of the one. Can anyone help?
I copy and pasted your pig game code you uploaded as I thought I messed up, but the turn doesnt end automatically when a player reaches a score of 50, anyone know how to fix this?
There is one edge case in the first game if all the players has the same score then by default the player 1 will win. Thanks
It looks so easy to code when watching someone but without help im happy to write hello world without error
Can you make some project tutorials on JavaScript
I want this game to be between/among two or more players which are registered in database in Django.
How?
I still need to get better at properly thinking about what I want my code to do. And then executing it. I don’t want to be in tutorial hell.