Reflection on Variables, print, and basic operands
I found that the errors I most encountered when attempting the first few exercises stemmed from the fact that I was trying to concatenate different variable types, or trying to do operands with different variable types. I had to be more mindful of what class each variable was. For example, I realized that I had to change a variable to a string using the str() function if I wanted to print out a numerical result in a full sentence. You can print an integer or a float, but you can’t print a string + an integer. Or, I also realized in Exercise 5: Celsius Converter that I cannot multiply an integer and a float together! In that case, the Type error was actuallly very informative (“TypeError: can’t multiply sequence by non-int of type float”). Since I had trouble identifying what class a result would be, I found Exercise 4 in Chapter 2 to be helpful and would like to find more practice like it.