Tuesday, January 31, 2017
Python: TurtleWorld and Polygons
Python: Modules and TurtleWorld
Sunday, January 29, 2017
Lists Done With Functions in Python
In the book Python Crash Course I learned how to use functions in Python and implement them into lists. It explains this on page 134, "When you want to perform a particular task that you've defined in a function you call the name of the function responsible for it." (Matthes 134). This taught me how to use functions in Python which simplifies my code to be more clean.
I also learned how to format my text with functions. This is explained on page 141, Functions can store values and format them to be more neat (Matthes 141). This taught me how to change format values I already have with a function which diversifies what I can do in Python.
How would you create your lists in Python?
Matthes, Eric. Python Crash Course: A Hands-on, Project-based Introduction to Programming. San Francisco: No Starch Press, 2016. Print.
Lists Done With a While Loop in Python
In the book Python Crash Course I learned how to use while loops in Python and apply it to lists. It explains what while loops are on page 122 it says, A while loop is a loop that runs as long as a value set in the loop is true. (Matthes 122). This taught me how to easily implement while loops into my code which helps me learn more of what I can do in Python.
I also learned how to stop a while loop before its condition is false. This is explained on page 125, "To exit a while loop immediately without running any remaining code in the loop, regardless of the results of any conditional test, use the break statement" (Matthes 125). This taught me how to implement a statement that can stop the loop which helps me improve at programming in the Python language.
What other programming language should I learn about?
Matthes, Eric. Python Crash Course: A Hands-on, Project-based Introduction to Programming. San Francisco: No Starch Press, 2016. Print.
List Done With a Dictionary in Python
In the book Python Crash Course I learned how to use dictionaries in Python and apply it to lists. It explains this on page 96, Dictionaries are a collection of pairs, the first part of the pair is a name while the second part is the value the name is associated with (Matthes 96). This taught me how to utilize other methods to create lists which helps me diversify how I program in Python.
I also learned how to add new pairs to dictionaries after making it. It also explains this on page 97, "To add a new key-value pair, you would give the name of the dictionary followed by the new key in square brackets along with the new value" (Matthes 97). This taught me how to improve upon dictionaries which helps me improve at programming in Python.
What program should I do next in Python?
Matthes, Eric. Python Crash Course: A Hands-on, Project-based Introduction to Programming. San Francisco: No Starch Press, 2016. Print.
Saturday, January 28, 2017
Python:Functions
Saturday, December 31, 2016
Python-Interactive Mode and Script Mode
If you code this into the interactive mode then the output would show up under it
As you can see on the left side is the script, and when executed there was no output on the right, or the shell. This is because we didn’t tell Python to print out the output which is sometimes confusing as stated before. “But if you type the same code into a script and run it, you get no output at all. In script mode an expression, all by itself, has no visible effect. Python actually evaluates the expression, but it doesn’t display the value unless you tell it to:” (Downey 17).
More in Depth Lists in Python
I learned how to develop my lists even more and make them more in depth. In the book Python Crash Course it showed me how to use if statements, on page 76 it said, You can change specific elements by using an if statement. (Matthes 76). This taught me how to change specific elements in a list to be more in depth and precise which leads to me being better at programming in the Python language.
Another thing the book showed me how to do was display user input, on page 118 it said, "The input() function pauses your program and waits for the user to enter some text. Once Python receives the user's input, it stores it in a variable to make it convenient for you to work with." (Matthes 118). This taught me how to implement code that can interact with the user which helps me become better at programming in the Python language because interactive programs are very useful.
What types of programs do you think are most useful?
Matthes, Eric. Python Crash Course: A Hands-on, Project-based Introduction to Programming. San Francisco: No Starch Press, 2016. Print.
Wednesday, November 30, 2016
Lists in Python
Matthes, Eric. Python crash course: a hands-on, project-based introduction to programming. San Francisco: No Starch Press, 2016. Print.
I learned how to make lists in Python and display them in multiple ways. In the book Python Crash Course it showed me how to reverse lists, on page 49 it said, You can reverse lists by using the name that defines a list and adding .reverse() to it. After that line you type print(name) and it will be printed in reverse. (Matthes 49). This taught me how to implement reversed lists into my code which helps me improve at programming in the Python language. Another thing the book showed me how to do was separate list items, on page 38 it said, "Write the name of the list followed by the index of the item enclosed in square brackets." (Matthes 38). This taught me how to implement a list into my code that looks more professional when printed which helps me improve at programming in the Python language.
What do you think the most important programming language is?
Matthes, Eric. Python Crash Course: A Hands-on, Project-based Introduction to Programming. San Francisco: No Starch Press, 2016. Print.
Python-The Programming Language
When starting to learn how to program the traditional first program is the "Hello World!” program. This program displays the worlds “Hello World!” into the display.
To write this program in Python it looks like this
However, when I first typed in the code I got results that looked like this.
This is because, I didn’t have apostrophe marks surrounding “Hello World!” this lead into an error classified as syntax error. “Python can only execute a program if the syntax is correct; otherwise, the interpreter displays an error message. Syntax refers to the structure of a program and the rules about that structure. For example, parentheses have to come in matching pairs, so (1+2) is legal, but 8) is a syntax error (Downey 4).” This made me realize what I did wrong and made me reevaluate my mistakes and learn from them. "The single most important skill for a computer scientist is problem solving. Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately (Downey 1).” While what I demonstrated above isn’t the most difficult of problems, it shows that problem solving is going to be a key skill for programming. This skill overall is going to be an important skill in life, as you might need to use problem solving in everyday scenarios.
Question: What are somethings that you do every day that require problem solving?
Downey, Allen B. Think Python: How to Think like a Computer Scientist. Sebastopol: O'Reilly Media, 2015. Print.