Two coding challenges this week! Part 1: Estimate the value of e. e is defined as  as n...

90.2K

Verified Solution

Question

Programming

Two coding challenges this week!

Part 1: Estimate the value of e.

e is defined as  as n goes to infinity. So the largerthe value of n, the closer you should get to e.

math.e is defined as 2.718281828459045

You'll write a program that uses a while loop to estimate e towithin some defined error range, while having a limit on how manyiterations it will attempt.

Part 2: Palindrome detection

A palindrome is a string that is the same forwards andbackwards.

Madam I'm Adam
Racecar
Was it a cat I saw?

There are many sophisticated ways of detecting palindromes. Someare surprisingly simple (s == s[::-1])

You will use a for loop to iterate over the contents of thestring to determine if it is a palindrome.

Beware! There are many solutions online. Don't fall prey tolooking this one up. It's not as hard as it looks. Draw it out onpaper first and think through how you index the string from bothends.

Answer & Explanation Solved by verified expert
3.7 Ratings (661 Votes)
A you didnt mentioned the programing language i did it inpythonpyhton program to find the value of e upto n decimalpointsimport decimalfind the factorial of n numbersdef factafac 1for i in range1 a    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students