Explore BrainMass
Share

An example python script to add numbers

This content was STOLEN 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 24, 2018, 11:30 pm ad1c9bdddf
https://brainmass.com/computer-science/python/example-python-script-add-numbers-196095

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.

$2.19
See Also This Related BrainMass Solution

Adding Grades, User Input And Prompted Key Board Output In Knoppix Environment Adding Loops Structures.

The Bash script must display the students letter grade based on the numeric average of combined test scores. The script should prompt user to enter numeric grades (test scores). Apply the loop structure to the portion of the script where the user is asked to enter the numeric grades. The script should also display the current date and time in Knoppix Linux.

Update the given script for above requirements, and also give a pseudo code for the script logic.

The appropriate letter grade for the number grade, should be computed using this scale:
90 to 100: Display a letter grade of "A"
80 to 89: Display a letter grade of "B"
70 to 79: Display a letter grade of "C"
65 to 69: Display a letter grade of "D"
0 to 64: Display a letter grade of "F"

View Full Posting Details