Write a python program that asks the user to enter a string containing numbers separated by...

70.2K

Verified Solution

Question

Programming

Write a python program that asks the user to enter a stringcontaining numbers separated by commas, e.g., s = '1.23,2.4,3.123',Your program should then calculate and print the sum of the numbersentered. Hint: you need to iterate over the string searching forthe commas, i.e. their index. The first number is obtained byslicing between the start of the string and the index of the firstcomma. The second number is between the last comma and the nextone, and so on. For this program do not use the standard stringfunctions.

Answer & Explanation Solved by verified expert
3.7 Ratings (450 Votes)
Program to add numbers in a string without usingstandard string functionssinputs taking input from the userlastpos0 this will store the index of last comma foundsum0 our    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