Software Carpentry: American University Dates: Monday through Thursday, Nov 9-12 Time: 10 am - 3 pm ET Workshop website: https://annajiat.github.io/2020-11-09-american-online/ Lesson website: https://software-carpentry.org/lessons/ Etherpad (this document): https://pad.carpentries.org/2020-11-09-american-online Feedback form: Please fill up the following form at the end of each day to help us improve https://docs.google.com/forms/d/e/1FAIpQLScS2cxi4ArrrDNfbktURliIvMwFseyjxtqFCUv0d2IjKBaDHQ/viewform Welcome to Software Carpentry * We will use this Etherpad for sharing links, code snippets, notes, ask/answer questions, etc. * From the upper right corner of this screen, please change "anonymous" to yourname and if you wish, please choose a color for your writing. * There is a chat window at the bottom right corner. In case of zoom difficulties, please notify us using that. * In this part at the left, we will keep adding our notes as we go through the workshop. You can also add your notes/questions here as well. This pad is synchronized as you type, so that everyone viewing this page sees the same text. This allows us to collaborate seamlessly on this document. * From the upper right corner, you can choose to save your own copy of this document by clicking the double arrow and choosing HTML or other formats. * In case this page keeps showing error, please keep it closed for few minutes and open again. * Both this page and the lesson pages will remain available online after the workshop. In case you need to review anything, please feel free to visit the links again! Host * Melissa L. Becher, American University Instructors * Annajiat Alim Rasel, Brac University, @annajiat * Elnaz AMANZADEH: elibio449@gmail.com * Jesse Johnston (he/him), Univ. of Michigan (supporting instructor) @jesseajohnston, https://orcid.org/0000-0003-2617-0166 Helpers * Amanda Steadman, American University * Stefan Kramer, American University Code of conduct * Use welcoming and inclusive language * Be respectful of different viewpoints and experiences * Gracefully accept constructive criticism * Focus on what is best for the community * Show courtesy and respect towards other community members * More details at https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html Guidelines * Zoom chat can be used to ask questions or provide comments or express difficulties during the lesson. Type “hand” in the chat, or type the question into the chat, or use a “raise hand”. To request assistance, message helper or indicate the red x "no" in the participants chat. * Helpers may continue to reply there or via zoom private chat as needed. * If necessary, helpers may temporarily move to a zoom breakout room with you to discuss in details using audio/screen sharing. You can return to the main session by leaving the breakout room. * You can participate in the polls during the lesson by clicking Zoom Participants Panel and clicking on yes/no. * If we are going too fast/slow, please indicate by clicking >>>go faster or << error Why don’t max and min return None when they are given no arguments? Marissa it would not be enough information to troubleshoot, in case someone accidentally forgot to add an argument Donna Jennifer - Fred - Questions from the morning? JJ to all: Did we answer the question about different types of division? You want to select a random character from a string. 1. Which standard library module could help you? see https://docs.python.org/3/library/ Silvina: random libraries, searched for word "rand om" in the list of libraries Code: *import math as m angle = ____.degrees(____.pi / 2) print(____) 1. What method call will display the first three rows of this data? 2. What method call will display the last three columns of this data? (Hint: you may need to change your view of the data.) Write an expression to find the Per Capita GDP of Serbia in 2007. Useful for working through on your own: "Practice with Selection" exercise Data from Gapminder: https://www.gapminder.org/data/ --------------------------------------------------------------------------------------------------- Day 3: November 11, Wednesday --------------------------------------------------------------------------------------------------- Roll call: * Jesse (supporting instructor) * Amanda (helper) * Jennifer Lopez (learner) * Fred (learner) * Melissa Becher (helper/host) * Elnaz (instructor) * Annajiat (instructor) Any questions from Day 2? * Matplotlib documentation: https://matplotlib.org/3.3.2/index.html * information on how to modify the ticks on the axes: https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.axes.Axes.autoscale_view.html#matplotlib.axes.Axes.autoscale_view * https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.pyplot.locator_params.html#matplotlib.pyplot.locator_params * Here is the parameter for matplotlib that allows you to modify the tick values: https://matplotlib.org/3.3.2/api/ticker_api.html#matplotlib.ticker.MultipleLocator Notes for Day 3 * Lessons: Starting at python "lists" http://swcarpentry.github.io/python-novice-gapminder/11-lists/index.html * Annajiat shared information about python conventions: http://swcarpentry.github.io/python-novice-gapminder/11-lists/index.html * Loops: http://swcarpentry.github.io/python-novice-gapminder/12-for-loops/index.html * Resource for tracking variables during execution of loops & programs: http://pythontutor.com/visualize.html#mode=edit * Conditionals: http://swcarpentry.github.io/python-novice-gapminder/13-conditionals/index.html * Functions (http://swcarpentry.github.io/python-novice-gapminder/16-writing-functions/index.html) * Common syntax of functions: * starts with def * requires a name() (you define the name) * inside parens, specify if the function takes any arguments (can be used within the function) * the "activity" of the function is indented under the line beginning with "def" * One way to describe the function is as a recipe (instructions on what to do), and the arguments are like the ingredients (the things that go into the function) * Every function call produces some result. * If the function doesn’t have a useful result to return, it usually returns the special value None. Exercise: #Fill in the blanks so that the program below produces the output shown. values = ____ values.____(1) values.____(3) values.____(5) print('first time:', values) values = values[____] print('second time:', values) #first time: [1, 3, 5] #second time: [3, 5] Useful resources: * https://annajiat.blogspot.com/2020/08/python-code-convention-or-style-guide.html * http://pythontutor.com/visualize.html#mode=edit * Day3: Afternoon Session lessons: 1. http://swcarpentry.github.io/python-novice-gapminder/16-writing-functions/index.html 2. http://swcarpentry.github.io/python-novice-gapminder/17-scope/index.html 3. http://swcarpentry.github.io/python-novice-gapminder/18-style/index.html extra useful links: 1. http://swcarpentry.github.io/python-novice-gapminder/04-built-in/ 2. https://www.python.org/dev/peps/pep-0008/ 3. https://docs.python.org/3/ Question: Please write down three points about the code which you see in my Jupyter Notebook. * Marissa : * Donna : * Jennifer : (1) The code is separating out eggs based on mass. (2) Starts out with an if function, continues on with else if based on size. (3) Finishes with the eggs that did not fit into any category with the else function and labels them "small." * Fred : This is an egg sorter, which does it by mass. The smallones are considered to be spoiled or unfit. Q2: Why we get "None" when we run code: result = print_date(1871, 3, 19) print('result of call is:', result) * Marissa : * Jennifer : * Fred : * Marissa : * Jennifer : * Fred : --------------------------------------------------------------------------------------------------- Day 4: November 12, Thursday --------------------------------------------------------------------------------------------------- Version control with Git: https://swcarpentry.github.io/git-novice/ GitHub repository links: https://github.com/annajiat/planets https://github.com/morskyjezek/planets https://github.com/jennlopez49/planets - @jesse added venus.txt https://github.com/mlbecher/planets https://github.com/ajsteadm/planets