Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comma Code #3

Open
Garrowni opened this issue Oct 2, 2023 · 1 comment
Open

Comma Code #3

Garrowni opened this issue Oct 2, 2023 · 1 comment

Comments

@Garrowni
Copy link
Owner

Garrowni commented Oct 2, 2023

Comma Code - https://automatetheboringstuff.com/2e/chapter4/
Say you have a list value like this:

spam = ['apples', 'bananas', 'tofu', 'cats']

Write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous spam list to the function would return 'apples, bananas, tofu, and cats'. But your function should be able to work with any list value passed to it. Be sure to test the case where an empty list [] is passed to your function.

@Garrowni Garrowni converted this from a draft issue Oct 2, 2023
@Garrowni Garrowni self-assigned this Oct 2, 2023
@Garrowni Garrowni moved this from Todo to In Progress in Nikkis Home Base Oct 2, 2023
@Garrowni
Copy link
Owner Author

Garrowni commented Oct 2, 2023

Useful reference: https://docs.python.org/3/library/stdtypes.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant