You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!")
The text was updated successfully, but these errors were encountered:
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
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
reverse_string("hola")
This is what is in the correct GitHub version:
def reverse_string(input_str):
answer = ""
# Your code goes here
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!")
The text was updated successfully, but these errors were encountered: