Skip to content

Intro-Python-CS27 - #3

Open
karsevar wants to merge 5 commits into
masterfrom
mason-karsevar3
Open

karsevar wants to merge 5 commits into
masterfrom
mason-karsevar3

Conversation

@karsevar

@karsevar karsevar commented Mar 9, 2020

Copy link
Copy Markdown
Owner

No description provided.

@karsevar
karsevar requested a review from amlane March 10, 2020 19:22

@amlane amlane 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.

Project meets MVP goals. Great job! Code is clean and well organized. I appreciate you really digging into the curriculum. Keep it up!

Comment thread src/11_args.py
total = 0
for num in args:
total += num
return total

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.

Another fun way you could write this is using the sum() method in Python like this:

def f2(*args):
    return sum(args)

Comment thread src/11_args.py

# YOUR CODE HERE
def f3(num1, num2=1):
return num1 + num2

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.

Very clean! I like how you did this compared to my solution in CS25.

Comment thread src/11_args.py
# YOUR CODE HERE
def f4(**args):
for key in args:
print(f'key: {key}, value: {args[key]}')

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.

I like how you used the f string! Another way you could write this in Python is using the items() method. There's also a values() method.

def f4(**kwargs):
    for key, value in kwargs.items():
        print(key, value)

Comment thread src/bar.txt
@@ -0,0 +1,3 @@
Hello there!
this is john wayne
it is me!!!

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.

Hello, John!

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