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*

13 thoughts on “Class 02 – Print, Markdown, directories, lists

  1. The Notes book instructions were clear and straight forward! It’s a great foundation for the rest of the semester.
    Maybe the first two notebooks can be lecure style to reduce the learning curve, and slowly transition to reading notesbooks on 3rd and 4th class.

  2. For myself, this felt like our first real day of coding. As such it felt important that this lesson was digestable and collaborative. The directory-switching portion of the class brought the most difficulty, but posed a useful setting to work with other students. The section targeted at print statements and basic math were a simple foundation for the coding portion. Because the results could be expected (ie. 2 x 3 = 6), the notebook was able to focus on the construction and use of python as a language. Lastly, the homework posed a nice level of a challenge; there was little complexity in the goal but it took a bit of time translate into a coding language. Although relatively basic in its content, this notebook and homework served as a lovely start-line to the semester.

  3. This class really marked the turning point for me where I finally felt like I knew what I was doing with Python. The instructions in the packet were clear, and I especially appreciated how there were some codes which were intended to show up as errors because this really helped me align my thinking with the program and avoid common mistakes which I probably would have made. As for the homework – I had a lot of fun creating the B, a lot of it was just trial and error. I think I had to run, tweak and re-run my code at least 30 times before getting the right B!

  4. This class was crucial in preparing for the rest of the year. Often when I had an error, it was due to a directory issue. I think this class was clear, concise, and incredibly important.

  5. This class was definitely a very good idea as one of the introductory classes towards Python. It allows you to understand exactly where on your computer you are going to be working throughout the semester. I had a lot of trouble with it at first because I didn’t understand the concept of directories and I couldn’t find where on my computer I was working until a few classes later, since it was hidden under a bunch of other directories. Having more clarification on what directories are and how to find yours would have been helpful. The lists notebook was also very helpful with introducing us to formatting, which is central to the rest of the course, and I had no problems with it.

  6. This class was cool because it set up our knowledge of navigating through our computer. Since this was one of the early classes, not many of the students were talking through their understanding. I wish there were instructions in the packet to turn to a neighbor to discuss why learning how to navigate through directories would become important, or some activity like that. Because it is a flipped classroom, I with there was more facilitation of student discussion.

  7. I found this class to be helpful and fun. The only thing that was confusing is if our B had to be identical to yours, because I think there were some cases where it might be larger or smaller in scale but still created correctly. The formatting practice was helpful.

  8. This class built the framework that we used a lot in later classes. It would have been really helpful to see how to use directories to save images (and plots) that you create. I think that was something maybe to include later. Also in terms of reading in data, how to call specific files (examples of excel, csv, png, pdf etc.). In terms of the strings, the packet was easy to follow and the plethora of examples really drilled it in.

  9. This class was very useful, as I find myself navigating through directories a lot. It becomes especially useful when I’m reading in data from Excel that I downloaded, and I have to move into my “downloads” directory. It helped me visualize the way things are structured and where they’re located, which is definitely important when downloading data, images, etc. that may be stored in different locations.

  10. For the most part, this was a solid class notebook. However, I remember wanting to know more about what directories mean and more about the technical relationship between the command prompt and jupyter etc. This might be a nice place to skim the surface of the more involved python mechanics. While, for the course, I didn’t need to know what a kernel was or how to add a directory within Anaconda, it would have made troubleshooting easier later on and I think would help me with expanding my python knowledge in my future.

  11. I also found this class to be pretty straightforward, to echo what was said above. The directory structure diagram was particularly helpful although I sometimes still get a bit confused when switching directories. The indexing notebook was very clear, especially at the end where you show all the different ways to use the [:::] nomenclature.

  12. I thought this class was quite clear – the homework was a bit confusing at first because I was unsure what you meant with moving the cursor and having no spaces, but after going back through the class notes the homework made sense.

Leave a Reply