Class 02 – Print, Markdown, directories, lists

Goals:

  1. We are going to learn some basic programming.
  2. Changing directories. (pdf=directory-structure – Jupyter Notebook) This is our first notebook for today.  We are doing two.
    1. Reminder.  If you want to download it from github right click on raw and choose save link as.  If you get a .txt file ending change it it .ipynb and you can now open it in your jupyter notebook.
  3. Markdown,
  4. basic math
  5. printing
  6. introduction to Python printing and lists (pdf=intro-to-python-types-print-lists)  This is our second notebook for today.

VIDEO FOR TODAY

QUIZ for after Video

  1. Remember that you need to take the quiz before class on courseworks!  It is labeled quiz 1 and called

    Quiz 1: Python Video on Directories and Printing

 

Notebook 1 Due beginning of Next class. (Monday January 22, 2024)

  1. Code.org intro course through stage 5 to stay on track.
  2. Look at the directory structure of your computer and make a place to work from when using Python (not graded, for your own organization)
  3. Use one print statement to make the Barnard B out of b’s with no spaces in the code but you can use backslashes in the print statements.  My example is below but you can make yours look nicer!  Your answer does not have to look exactly like mine.  But you need to use one print statement and that print statement can not have any spaces.
  4. Use print statements and .format to answer the math questions below exactly the same way with the exact formatting.  You need to set a and b and use them in your format statement.  Your print statement cannot have numbers.  Repeat-There are no numbers in your print/format statement.  You set the a and b before the print statement.
  5. Use Markdown in your homework to add your name and other critical information.  the homework should look nice with a nice Markdown header describing the homework.  This is critical.  You must add your name, date, section, and assignment in markdown.
  6. Upload your homework to courseworks.  You upload the notebook.  The file you upload should end in .ipynb
  7. Watch Next Video and Take Quiz

 

Barnard B (Really looks more like an 8)

Your answer should be similar to but hopefully nicer than

BBBBB
B        B
B        B
BBBBB
B        B
B        B
BBBBB

 

Use the print function and then \n or \t or something similar to move the cursor.  there should be NO SPACES in your print function!

 

Set
a=9.000
set b=4.000
Write the following sentence exactly.  using the .format nomenclature and no numbers only variables.  Use the a and b that you set in the format and print function.  Use the different operators with your variables.  Look at today’s handout for examples with the print and format functions.  The * should be in with the formatting calls.
When 9 is divided by 4.00 the answer is *2* with a remainder of 1.0
Then to check you did it correctly.  I will open your notebook.  I will change your a=9 to a=11 and it should give me this sentence
“When 11 is divided by 4.00 the answer is *2* with a remainder of 3.0”
During grading I also changed a to 15 and you should get a *3*