You are on page 1of 1

# In the high-level programming language that your school has chosen to use,

writeand run a short program using a condition-controlled loop to allow the user
toinput the weight of sacks of rice and to count the number of sacks the user
hasinput. When the user types in ‘-1’ this should stop the process and the
programshould then output the number of sacks entered and the total weight.
TotalWeight=0
weight=0
Num=0
while weight!=-1:
weight=int(input("Enter the weieght of the rice sack, enter -1 whend done: "))
TotalWeight= TotalWeight+weight
Num=Num+1
print("Total weight of the rice sack:",TotalWeight+1)
print("Number of sacks were: ",Num-1)

You might also like