Search 80,731 tutors

Blogs Blogs

Python Blogs

Newest Most Active

It’s 5pm on Sunday evening and you decide it’s time to break out your 1st Java assignment, which is due later that evening at 12am. No big deal, you have plenty of time! What can’t you do in seven hours? I mean that’s like at least 40 games of Halo. You stall another hour (playing Halo) until six 0clock at which point you decide you better get started just in case. You glanced at the problem earlier in the week, no biggie. A couple of inputs, some basic processing, some formatted output, and maybe the professor threw in some easy twist. Two maybe three hours tops, you’ll be counting sheep by ten.   The clock strike’s ten; you have 25 IM windows open (3 hopefuls). You’ve Googled the same thing 25 times, you have more red squiggly lines than if you had written a letter in Spanish inside MS. Word, your code doesn’t compile,  and it looks like this…   public class Chaos {       //default constructor public Chaos()    ... read more

There is very little emphasis these days on teaching programming, in spite of the fact that technology is becoming more and more a dominant aspect of our lives. Perhaps this is because many programmers are self-taught, used to working alone on projects, and therefore the assumption is that students will learn programming "as they go" or "on their own". This is unfortunate because I think that this aversion to traditional instruction and the preference for "self-taught" programmers leaves some people who want to learn in the dust.   I have lately become interested in rectifying this problem. A few of my clients have discussed the option of learning programming through tutoring sessions with me. I think that if I had been able to avail myself of such an option when I was first learning to program, I might have had a much easier time in learning how to properly use computers as the powerful tools that they are. I believe, however, that... read more

1. Take the sentence: All work and no play makes Jack a dull boy. Store each word in a separate variable, then print out the sentence on one line using print. #! /usr/bin/env python3 # ex1 - words # All work and no play makes Jack a dull boy. word1 = "All" word2 = "work" word3 = "and" word4 = "no" word5 = "play" word6 = "makes" word7 = "Jack" word8 = "a" word9 = "dull" word10 = "boy." print(word1, word2, word3, word4, word5, word6, word7, word8, word9, word10) 2. Add parenthesis to the expression 6 * 1 - 2 to change its value from 4 to -6. #! /usr/bin/env python3 print("6 * 1 - 2 = ", 6 * 1 - 2) print("6 * (1 - 2) = ", 6 * (1 - 2)) 3. Place a comment before a line of code that previously worked, and record what happens when... read more

Chapter 2 of How to Think Like a Computer Scientist begins actually exploring Python and its features.   The chapter discusses variables, expressions, and statements. It starts out discussing data types and using the type() function to determine the type of some literals, like strings, integers, and floats. It also discusses using different kind of string delimiters.   Variables have a name and can be created by using the name you want to give the variable, the assignment token (=), and a value, like so:   lunch = "sandwich" weight = 150   Variable names have to begin with a letter or underscore (_) and can't be one of Python's reserved keywords (   Statements are instructions that python can perform. Examples given are while, for, import and others.   Expressions are combinations... read more

In preparation for offering Python as a subject I'm planning on reviewing and refreshing my basic Python programming skills using the online text "How to Think Like a Computer Scientist", located at:   As I progress through the chapters I plan on writing a brief summary and reflection on the topics covered. I also plan on posting my answers to selected problems from the text.   Python is an exciting, powerful, but easily learned programming language, with a large selection of libraries for achieving many common tasks from file i/o, networking, and various mathematical functions, to cross platform gui development, application scripting and automation, and other useful and advanced tasks.   Obligatory XKCD:    

Python Blogs RSS feed