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

Colaboratory Notebook Problem: Lesson 5 Practice Problems, Reversing a string #296

Open
mikaturner opened this issue Feb 23, 2023 · 0 comments

Comments

@mikaturner
Copy link

mikaturner commented Feb 23, 2023

The colaboratory notebook version of this only has the answer and not the practice problem or test assertions.

This is what is in the notebook version:
def reverse_string(input):
answer = ""
# Your code goes here

for letter in input:
  answer = letter + answer
#  End of your code
return answer

reverse_string("hola")


This is what is in the correct GitHub version:

def reverse_string(input_str):
answer = ""
# Your code goes here

#  End of your code
return answer

Tests below, do not change

assert reverse_string("hello") == "olleh", "Cannot reverse 'hello'"
assert reverse_string("") == "", "When given an empty string it returns an empty string, but doesn't"
assert reverse_string("racecar") == "racecar", "Cannot reverse 'racecar'"
assert reverse_string("12345") == "54321", "Cannot reverse 12345"

If the program gets here, the code works!

print("Your solution works!")

@mikaturner mikaturner changed the title Notebook Problem: Lesson 5 Practice Problems, Reversing a string Colaboratory Notebook Problem: Lesson 5 Practice Problems, Reversing a string Feb 23, 2023
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

No branches or pull requests

1 participant