Posts

Showing posts with the label #Programming

Tic - Tac - Toe

Image
This is from a blog post called “Zero Sum  Game” If you know what you are doing, you can't lose at Tic-Tac-Toe. If your opponent knows what they are doing, you can't win at Tic-Tac-Toe. The game is a zero sum game. If both players are playing with an optimal strategy, every game will end in a tie. This was a hard project.  You just don't realize all of the logic that goes into a simple game, until you have to start mapping it out. I did a bit of extra research and added a few things that we haven't covered yet in class.  The code below checks for user input and verifies whether or not it is a numeric input.  (while move.isdigit()) Here is the entire code.

My first "All-Nighter"

Image
 Work on my first "all-nighter" trying to write a small piece of code that converts Arabic numbers Roman numerals.  Wow... What I was the most satisfied with is that I didn't go out to the web looking for a solution.  My only external references were those of syntax. Below is a small snippet of code. Here is the code

Collatz Hypothesis

Image
Section 3 - Lab 15  Link to Lab File Scenario In 1937, a German mathematician named Lothar Collatz formulated an intriguing hypothesis (it still remains unproven) which can be described in the following way: take any non-negative and non-zero integer number and name it  c0 ; if it's even, evaluate a new  c0  as  c0 ÷ 2 ; otherwise, if it's odd, evaluate a new  c0  as  3 × c0 + 1 ; if  c0 ≠ 1 , skip to point 2. The hypothesis says that regardless of the initial value of  c0 , it will always go to 1. Of course, it's an extremely complex task to use a computer in order to prove the hypothesis for any natural number (it may even require artificial intelligence), but you can use Python to check some individual numbers. Maybe you'll even find the one which would disprove the hypothesis. Write a program which reads one natural number and executes the above steps as long as  c0  remains different from 1. We also want you to count the ...

Learning different methods of loops using WHILE and FOR

Image
  The labs that we are doing are still very small but are helping us learn valuable tools that will be used and built upon as we progress.  The small snippet of code uses a FOR loop and after taking user input, evaluates the string one letter at a time and prints it if it is a non-vowel. PY file for this lab

Week 3 - Just getting fun!

Image
 Three weeks into the class, and we are now getting into the meat of things I remember how to do in other languages. Loops, variable, etc.  Here is a simple lab I did today.  The secret word to be guessed is "chupacabra".  The user attempts to guess the secret word, and is kept in the loop until they guess it correctly.  I put in a check for an upper or lower case solution.  One the secret word is entered, the loop is broken.

Learn to code, he said!

Image
Having been recently demoted at my place of employment, I decided to follow through on something I very much wanted to do before the demotion.   My first year out of high school was 1983, and I enrolled at the local Community College as a Computer Science Major. I had a great time learning COBOL, Fortran and Pascal, to add to the Basic that I had already taught myself after hours spent in the dark, damp basement of our home.  But like many dreams, this one morphed into another dream which took me down the road of pursuing another passion by going to culinary school.   I've always loved the challenges of writing a fresh piece of code that makes a computer do something, show something or solve a problem. Over the years I've dabbled in Javascript and Excel VBA, and that was about the extent of my "programming". Then I saw an opportunity at the local Vo-Tech to take a class in Python. I did a bit of research and found that Python is a very powerful programming l...