Skip to content

Commit 1c30570

Browse files
committed
Minor edits to workshop 1
1 parent cfe1d2f commit 1c30570

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ round(3.712, 1)
423423
424424
2. Python reports a runtime error when something goes wrong while a program is executing
425425
426-
### **Beginner Challenge**: What happens when?
426+
### **(Optional) Beginner Challenge**: What happens when?
427427
428428
Explain in simple terms the order of operations in the following program: when does the addition happen, when does the subtraction happen, when is each function called, etc. Extra credit: What is the final value of radiance?
429429
@@ -848,7 +848,19 @@ print(good_str1, "\n", good_str2)
848848
849849
### (Optional) Methods are functions that belong to objects
850850
851-
1. An object packages data together with functions that operate on that data. This is a very common organizational strategy in Python.
851+
1. You can view an object's attributes (i.e. methods and fields) using `help()` or `dir()`. Some attributes are "private"; you're not supposed to use these directly.
852+
853+
``` python
854+
# More verbose help
855+
help(str)
856+
```
857+
858+
``` python
859+
# The short, short version
860+
dir(my_string)
861+
```
862+
863+
2. An object packages data together with functions that operate on that data. This is a very common organizational strategy in Python.
852864
853865
``` python
854866
sentence = "Hello world!"
@@ -857,7 +869,7 @@ print(good_str1, "\n", good_str2)
857869
print(sentence.swapcase())
858870
```
859871
860-
2. You can chain methods into processing pipelines
872+
3. You can chain methods into processing pipelines
861873
862874
``` python
863875
print(sentence.isupper()) # Check whether all letters are uppercase
@@ -869,19 +881,7 @@ print(good_str1, "\n", good_str2)
869881
sentence.upper().isupper()
870882
```
871883
872-
3. You can view an object's attributes (i.e. methods and fields) using `help()` or `dir()`. Some attributes are "private"; you're not supposed to use these directly.
873-
874-
``` python
875-
# More verbose help
876-
help(str)
877-
```
878-
879-
``` python
880-
# The short, short version
881-
dir(my_string)
882-
```
883-
884-
### **(Optional) Challenge**: Putting it all together
884+
### **Challenge**: Putting it all together
885885
886886
You want to iterate through the `fruits` list in a random order. For each randomly-selected fruit, capitalize the fruit and print it.
887887

README.org

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ round(3.712, 1)
414414

415415
2. Python reports a runtime error when something goes wrong while a program is executing
416416

417-
*** *Beginner Challenge*: What happens when?
417+
*** *(Optional) Beginner Challenge*: What happens when?
418418
Explain in simple terms the order of operations in the following program: when does the addition happen, when does the subtraction happen, when is each function called, etc. Extra credit: What is the final value of radiance?
419419

420420
#+BEGIN_SRC python
@@ -776,15 +776,26 @@ len("".join(fruits))
776776
#+END_SRC
777777

778778
*** (Optional) Methods are functions that belong to objects
779-
1. An object packages data together with functions that operate on that data. This is a very common organizational strategy in Python.
779+
1. You can view an object's attributes (i.e. methods and fields) using ~help()~ or ~dir()~. Some attributes are "private"; you're not supposed to use these directly.
780+
#+BEGIN_SRC python
781+
# More verbose help
782+
help(str)
783+
#+END_SRC
784+
785+
#+BEGIN_SRC python
786+
# The short, short version
787+
dir(my_string)
788+
#+END_SRC
789+
790+
2. An object packages data together with functions that operate on that data. This is a very common organizational strategy in Python.
780791
#+BEGIN_SRC python
781792
sentence = "Hello world!"
782793

783794
# Call the swapcase method on the my_string object
784795
print(sentence.swapcase())
785796
#+END_SRC
786797

787-
2. You can chain methods into processing pipelines
798+
3. You can chain methods into processing pipelines
788799
#+BEGIN_SRC python
789800
print(sentence.isupper()) # Check whether all letters are uppercase
790801
print(sentence.upper()) # Capitalize all the letters
@@ -795,17 +806,6 @@ len("".join(fruits))
795806
sentence.upper().isupper()
796807
#+END_SRC
797808

798-
3. You can view an object's attributes (i.e. methods and fields) using ~help()~ or ~dir()~. Some attributes are "private"; you're not supposed to use these directly.
799-
#+BEGIN_SRC python
800-
# More verbose help
801-
help(str)
802-
#+END_SRC
803-
804-
#+BEGIN_SRC python
805-
# The short, short version
806-
dir(my_string)
807-
#+END_SRC
808-
809809
*** COMMENT (Optional) Building longer strings with ~.join()~
810810
This is replicated in the functions section
811811
1. Use ~.join()~ to concatenate strings
@@ -822,7 +822,7 @@ This is replicated in the functions section
822822
print(date)
823823
#+END_SRC
824824

825-
*** *(Optional) Challenge*: Putting it all together
825+
*** *Challenge*: Putting it all together
826826
You want to iterate through the ~fruits~ list in a random order. For each randomly-selected fruit, capitalize the fruit and print it.
827827
1. Which standard library module could help you? https://docs.python.org/3/library/
828828
2. Which function would you select from that module? Are there alternatives?

0 commit comments

Comments
 (0)