Posts

Showing posts from September, 2018

Python Projects : The Coin Flip game v2

Hello World,  I hope you have been doing well, today I'm going to tell you about a simple program that I made for one of my homework projects. The python code is available on my GitHub Repo if your interested. The chapter was talking about how to have the computer generate random numbers and having some kind of interaction with the user. So the challenge was to create a program, that would "flip a coin" 5 times and then tell you how many times it got "heads" or "tails". After some trial and error I got it to run properly..so I decided to create a 2nd version. In the 2nd version, I wanted to give the user a couple of options: Option 1: To run through the program as many time as they liked without having to restart it. Option 2: To choose the amount of flips the coin does. I'm a big fan of giving the user options, I don't like to limit things to a set pattern, especially if the extended options would make the game more enjoyable (hopeful

Python Project : Digital Dice

Hello World, Today I'm going to tell you about a little program that I did, it was inspired by a conversation I had with a friend of mine. My buddy plays D&D (Dungeons & Dragons), and this game relies on dice rolls to help you make decisions through out the game. He plays with his friends via Skype or google Hang Out, which I thought was cool, they all log in and start playing, so I asked him "well, what do you do about the dice rolls?" and he told me that each one of them rolls the dice on their desks and then they tell each other what they rolled. I then asked him how many different die do they use? because I only know about the D20 die, and he then told me that it would vary on the game, it could be any thing. So that got me thinking, why not have a digital dice program that would "roll" the dice for you? And I made it in a way that you get to choose the range of the dice that you want to roll. And that's when I decided to make one. You can f

Python Projects : FUNctions ()

Hello World,  The last post I did was about creating a simple While Loop, and how that has helped me tremendously with having my programs run a bit smoother, with cleaner code. Well the same can be said of functions, they come in very handy, especially for repeating situations. I found that the combination of that simple While Loop + a simple Function is quite helpful. Python makes it SUPER simple to create, define and call a function. Here is a quick example. # Defining the function def new_function():        print("This is  a working function") # Calling the function new_function() That's it, its very simple to do, and I use this method a lot to make sure that my logic is working, especially if there will be multiple things happening. This is a great way to keep things organized, and to keep your code clean. Its also a great way to make corrections or upgrades in only one place, especially if the function is called or used in multiple places. Keep in min