Homework 2: Finding Your Way in R and Python

Author

Your Name

Download the starter qmd file here

MadLibs

Running a Python Script at the command line

Run the script madlibs.py using the terminal to run the script (e.g. type python3 madlibs.py in the terminal). Do what it asks of you. Copy the text after the initial command and paste it between the markings below. (These define a generic, no-language markdown code chunk).

# Paste your output here!

Can you run this same script in RStudio using the Source Script button? If you can, please describe any differences you note compared to using the terminal. If you cannot, tell me what happens.

Reserved Words

Does the madlibs.py script use any reserved words? How can you tell?

Code Highlighting

Are there any other words that stand out when you open up madlibs.py in RStudio? What do they do? How do they appear?

Thinking Critically

Look at the quarto file from Homework 1. What features does RStudio provide that would help you identify code? Comments? YAML markup (the header at the top of the file, where the document title/author/date/output format are specified)?

How can you differentiate R code from python code in a quarto file?

How do links show up in the text editor?

Learn More

  1. Skim the quarto documentation on code cell options. Which 3 options do you think will be the most useful?

  2. When would you consider using #| eval: false at the start of a chunk?

  3. When might you use #| echo: false?

  4. What about #| output: false?