Skip to content

Python 1 - #1

Open
rrrbba wants to merge 17 commits into
masterfrom
rayven-burns
Open

Python 1#1
rrrbba wants to merge 17 commits into
masterfrom
rayven-burns

Conversation

@rrrbba

@rrrbba rrrbba commented Feb 10, 2020

Copy link
Copy Markdown
Owner

No description provided.

@rrrbba rrrbba closed this Feb 10, 2020
@rrrbba rrrbba reopened this Feb 10, 2020
@rrrbba
rrrbba requested a review from brianilles February 10, 2020 21:52

@brianilles brianilles left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent job completing the two day project on day 1. I'll leave this PR open if you'd like to continue working on stretch.

Comment thread src/00_hello.py
@@ -1 +1,2 @@
# Print "Hello, world!" to your terminal No newline at end of file
# Print "Hello, world!" to your terminal
print("Hello, world!") No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It all starts with a hello world :)

Comment thread src/01_bignum.py

# YOUR CODE HERE No newline at end of file
# YOUR CODE HERE
print(2 ** 65536)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in the JS console?

Comment thread src/04_printing.py
# Finally, print the same thing using an f-string No newline at end of file
print("x is {}, y is {:.2f}, z is {}".format(x,y,z))
# Finally, print the same thing using an f-string
print(f"x is {x}, y is {y:.2f}, z is {z}") No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent use of all three print implementations. Which is your fav?

Comment thread src/06_tuples.py
def print_tuple(t) :
print(t)
t = (1, 2, 5, 7, 99)
print_tuple(t) # Prints 1 2 5 7 99, one per line

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd like to print each value in the tuple on a separate line. How can we change this to accomplish that?

Comment thread src/08_comprehensions.py

for j in range(10):
y.append(j**3)
print(y)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work. How can we refactor this to be a List Comprehension?

Comment thread src/11_args.py

# YOUR CODE HERE

def f2(*args) :

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! What operator in JS is *args like?

Comment thread src/13_file_io.py

# YOUR CODE HERE

with open('foo.txt') as f:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great use of with open(). I pretty much use this exclusively for file IO as the file doesn't need to be explicitly closed.

Comment thread src/08_comprehensions.py
for a in a:
y.append(a.upper())
y = [q.upper() for q in a]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome refactor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants