Python: Starting Small

in STEMGeeks2 months ago

Hi fellow Programmers,

Today I've finally managed to get things squared away with Python and got some experience with starting a project or two!


Hive Divider Bar Text.png

Starting Small

One of the fun things and best ways for me to learn, as well as many others from what it seems like, is just diving right in and getting to starting to write and develop some projects. Writing computer code isn't easy but when you get experience with it, it's like anything it gets easier as time goes on.

I've been able to sit down and spend some more time lately going through Python and trying to learn what to do so I can get better at it. I know that there are things that I can do to get better and one of the main things is getting exposure and trying to build guided projects! There is a lot of things on the internet to help guide you along which is incredible. Let's dive into some of the small projects I decided to give a whirl and how they turned out!

All of the projects I've been doing can be found on this website here:

Rock, Paper, Scissors

The first project that I ended up doing was a nice Rock Paper Scissors type game. This one was pretty basic and interesting to learn to write. This ended up being one that was straight forward and fairly easy to program. The guides walk you through each of the steps needed to perform which is very helpful. The one tricky part is that you need to preferably have a Python IDE installed on your computer. I'm personally using PyCharm to do all of this. I know there are lots of different programs that can be used and I can't remember why I chose PyCharm specifically but it's pretty user friendly and intuitive.


The code that I used can be seen below. I am glad have figured out how to include code snippets with Markdown. I know I'm not very good at coding yet but I remember when I first saw these types of things, I was intimidated! Thankfully, it's pretty great to spend time going through the steps needed and figuring out any missteps.

from random import randint

#create a list of play options
t = ["Rock", "Paper", "Scissors"]

#assign a random play to the computer
computer = t[randint(0,2)]

#set player to False
player = False

while player == False:
    #set player to True
    player = input("Rock, Paper, Scissors?")
    if player == computer:
    elif player == "Rock":
        if computer == "Paper":
            print("You lose!", computer, "covers", player)
            print("You win!", player, "covers", computer)
    elif player == "Paper":
        if computer == "Scissors":
            print("You lose!", computer, "cut", player)
            print("You win!", player, "covers", computer)
    elif player == "Scissors":
        if computer == "Rock":
            print("You lose...", computer, "smashes", player)
            print("You win!", player, "cut", computer)
        print("That's not a valid play. Check your spelling!")
    #player was set to True, but we want it to be False so the loop continues
    player = False
    computer = t[randint(0,2)]

It took a bit for me to figure out how to create a new section so that I could start a new program. There are different components to it all, projects and files are the two big points. I had to figure out how to create a new file and specify that I was going to be using Python. Check!


Number Guessing Game

No my name isn't Scott, although it is one of the names that I don't find annoying lol. This game here was fun and pretty good to program! I had some missteps with this that came with me not following all of the instructions to the T. The program ran successfully but there were a few issues. We can see that I forgot to define the variable for number of guesses. That was the first and most obvious issue since it was highlighted in red.


I figured out my mistake there and corrected it, now it was time to fix the formatting around the "player name" section so that it pulls the right information. I put an extra pair of quotation marks than I needed so I had to remove that and fix the lack of a space.


Got that fixed as well and I was happy with the results! The final line is one I would like to eventually figure out how to remove since in a finished product, I don't think people want to see that information there. I have some other small formatting critiques but I am really happy with the end result!


Here is the code I used to write the program, if anyone is interested.

import random
number = random.randint(1,10)

player_name = input("Hello, What's your name?")
number_of_guesses = 0
print('Okay! ' + player_name+ ' I am guessing a number between 1 and 10:')

while number_of_guesses < 5:
    guess = int(input())
    number_of_guesses += 1
    if guess < number:
        print('Your number is too low')
    if guess > number:
        print('Your guess is too high')
    if guess == number:
if guess == number:
    print('You guessed the right number in '+str(number_of_guesses) + ' tries!')
    print('You did not guess the number, the number was '+ str(number))

All of the code I wrote in the post here is self-guided and not entirely my own. I think that it's certainly an improvement but I would like to eventually figure out how to write some basic code of my own that's entirely my own!

Hive Divider Bar Centered.png

Connect with me!

Do you want to get paid, in crypto, for searching the internet? Try using and signing up for Presearch to earn some great crypto! I've currently got 2,470 PRE tokens, with a market value of $59.28. It doesn't sound like a lot but when you search using sites like Google you get paid $0! Join Presearch to break Google's stranglehold on the internet searches. If you'd like to sign up, use my referral link!

Image sourcea


Good job!

I have got started in programming by writing tutorials on Hive (when it was still Steem). It is relatively easy to learn, but if you want to work in the field the challenge is getting the first experience.

Most jobs require experience. I had to write tutorials and record tutorials to show I know what I am doing, but after I have got the first freelance I was able to manage to grow until I have landed my current full time job!

Keep on going!

Yeah it's definitely tricky to get the experience. I'm learning and enjoying it for sure. Perhaps one day I can do it as part of, or primarily my job but I'm having fun with it so that's good. There's some aspects of it that are tricky but with learning things, it takes time for sure. I'm working through the different projects available and it's one of my best ways of learning. Application is much better than just reading!

Hopefully one day soon I can start to write the program that I will use to develop the game on hive that I've been planning for a few months. Who knows!?

Good job and keep up the good work. Really like it when I see others learning to program and to develop software.

Thanks! I appreciate it. It's a bit of a slow process going but one of the things that I'm enjoying is learning it. The more I do little projects like this, the more I'm able to apply what I'm learning and troubleshoot what went wrong, correct things and become better at it. Maybe one day I'll actually get to develop the game on hive that I've had in mind! Lol

Hey great job! I fell off of coding for a bit so I definitely want to pick it back up. Looks like you're making great progress.

Always great to keep learning. Good job and keep driving forward.

I like Python. I've been "coding" (sort of) for quite some time, and when given the choice, python is always my goto language.

When you're still learning I do highly suggest that you keep using the same editor; different editors handle indents differently, and it can cause a python script to go into convulsions.

Great work! It always feels good to have that sense of accomplishment.

Thanks for the great tips and feedback. Python definitely seems like it’s going to be a good language to get started with. It’s straight forward and not overly complicated like C. I tried C and hated it lol.

I’ve been using Pycharm. It seems to be a pretty good software program so I’m definitely going to keep using that. I know there are other ones out there but this one seemed like it was easy to install and use.

Pycharm is definitely good. Great choice. I've found that Visual Studio Code works for me, mainly because it has some great plugin support for other languages I'm forced I use, too.