Monday, December 7, 2015

Using Specific Module Functions in Functions


To solve the second problem in problem set 5, I decided to put the majority of the code in a function. I needed to use the sqrt function from the math module however it did not want to work on its own. I used specifically the following code to be able to use the sqrt function inside my quadratic solver function.

from math import sqrt

Sunday, December 6, 2015

Solving the Word Guesser


I was trying to solve the word guesser problem and I realized I needed to compare using lists. The lists would allow me to compare the letters 1 by 1 and space by space so the spaces would be correct. Using the list function allowed me to split both the random word and the users guess into individual lists to compare.

Thursday, December 3, 2015

Using the Random Module and Functions



For the first problem in the set, I was able to import the random and use the randint function to generate a random integer. I was able to choose the parameters "(1, 99)"

Monday, November 2, 2015

Using Sets and Set functions

When trying to figure out number 6 after doing research, I learned about sets. Using an two lists containing the characters of the words, a new set is created only using common elements from the two lists. This streamlines the process of comparing the two words and outputting common letters.


Sunday, November 1, 2015

Blank Space function

Needed to write function for blank space in the rock paper scissors game. Tried to do this not in function form but it wasn't as neat and efficient as the function form. It is also aesthetically pleasing. The amount of blank lines printed can be altered by changing "40" to however many blank line necessary.  


Monday, October 19, 2015

ROT13 Encoding

As I was trying to solve the problem of rotating the alphabet 13 characters I figured there had to be a better way of doing this. After some googling, I found out in the Python codecs module, a rot13 encoding function was in place.



By utilizing the build in codec, I was able to make my code compact and well organized. This also solved the problem of creating decryption code as well due to the way the rot-13 code works.

Thursday, October 15, 2015

Password Generator

This was the final code I ended up with  when I wrote the password generator. It was particularly hard to turn the list of all the information into a combine word with no spaces. I ended up working quite nicely with clear compact code. 

Friday, October 9, 2015

Name Interpreter and Greeter

This is the code I ended up using earlier when writing my greeter. This was one of the  earlier codes I wrote and was easy to add lowercase commands.

Thursday, October 8, 2015

Functions


 Playing around with functions, came up with this code initially. I was on the right track however it could be a lot more polished and functional.


This ended up being the polished code.