Explore BrainMass

Explore BrainMass

    An example python script to add numbers

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a program in python that continually reads in numbers from the user and adds them together until the sum reaches 100. Write another program that reads 100 numbers from the user and prints out the sum.

    © BrainMass Inc. brainmass.com October 9, 2019, 9:44 pm ad1c9bdddf

    Solution Preview

    Both of these programs will require using a while loop and a couple of variables. In the first problem we will continue to read numbers and sum them up until the sum is greater than 100. In other words, the "while" condition is "sum < 100" and the action we take in ...

    Solution Summary

    This solution shows how to write a python script to read numbers from the user and add them together. This demonstrates some of the basic python features.