Skip to content

Instantly share code, notes, and snippets.

@ashutoshpipriye
Created May 27, 2020 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashutoshpipriye/df6f2fdbcd21bf65d44d1eb8b1d12976 to your computer and use it in GitHub Desktop.
Save ashutoshpipriye/df6f2fdbcd21bf65d44d1eb8b1d12976 to your computer and use it in GitHub Desktop.
# Write code to count the number of characters in original_str using
# the accumulation pattern and assign the answer to a variable num_chars.
# Do NOT use the len function to solve the problem (if you use it while you are working on this problem, comment it out afterward!)
original_str = "The quick brown rhino jumped over the extremely lazy fox."
num_chars = 0
for i in original_str:
num_chars = num_chars + 1
print(num_chars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment