Part 1:

Manipulating Values: Strings & Integers

Omitting First Quotation Mark Error:

  >>> print(This seems like a fun idea!")  
    File "<stdin>", line 1  
        print(This seems like a fun idea!")  
                   ^
  SyntaxError: invalid syntax 
  >>>
  

Omitting Second Quotation Mark Error:

  >>> print("This seems like a fun idea!)
     File "<stdin>", line 1  
      print("This seems like a fun idea!)  
                                        ^ 
  SyntaxError: EOL while scanning string literal
  >>>

Omitting Both Quotation Marks Error:

  >>> print(This seems like a fun idea!)  
    File "<stdin>", line 1  
        print(This seems like a fun idea!)  
                   ^
  SyntaxError: invalid syntax 
  >>>
  

Manipulating - Operator:

  >>> 2++2  
  4
  >>> 2--2
  4
  >>> 2+-2
  0
  >>> 2-+2
  0
  

Leading Zeros in Python 3: Not Permitted as A Leading Integer

  >>>01
    File "<stdin>", line 1
      01
       ^
  SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
  >>>
  If one needs to display a leading zero, consider using print()
  ie)
  >>> print(0)
  0
  >>>
  
  As Navone explains, Python 2 accepted leading zeros but it lead to errors such as
  >>> 0000015
  13 
  because it was converting numbers from octal (base 8) to (base 10). (Navone, 2001)

Inputting Two Values without Operators

>>> 1 0
  File "<stdin>", line 1
  1 0
    ^
SyntaxError: invalid syntax
Python does not know what to the input isn't following syntax rules. (Downey, 2015)

Part 2:

Having Fun Experimenting with Python

Example 1: Adding

>>>1+2+3+4+5
15
>>>

Example 2: Subtracting

>>> 8--8
16
>>> 8----9
17
Each set of substraction operators turn into plus signs

Example 3: Multiple Operators

>>>8+5*5
33
Python is reading this as 8+(5*5) even without the parantheses 

What I’ve Learned From the Experiment

  • Personally I learn best from hands on activities like this. I still have an immature understanding of Python but this activity helped show me that I can do the basics of coding and that it’s ok to mess around in programming; nothing is broken at the end of the day.
  • I learned how much fun programming can be fun: this entire assignment was coded in RStudio R Markdown as a challenge to myself. I recently learned about R Markdown and wanted to see if I could code this. It took a decent amount of debugging and troubleshooting to get this formatted correctly. But like Downey (2015) states, “learning to debug can be frustrating, but it is a valuable skill that is useful for many activities beyond programming.” (p. 6)

REFERENCES

Downey, A. (2015). Think Python: How to think like a computer scientist. Green Tea Press. This book is licensed under Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0). Navone, Estefania. (2019, February 5). Leading Zeros in Python: A Hidden Mystery Revealed. Medium.com. Retrieved January 28, 2022, from https://medium.com/techmacademy/leading-zeros-in-python-a-hidden-mystery-revealed-ee3e3065634d