Python 3.4 - While Loops/ Count


Adding the functions of counting and totaling one can create a program that can keep track of certain data and use it to give totals, averages, etc.

tip_num = 0
total = 0.0
tip = input('please gimme tips')

while tip != "":
    tip_num += 1
    tip_value = float(tip)

    total += tip_value

    tip = input('please gimme tips')

print("You received", t5ip_num, "tips this evening!")

print("your total was", total)


https://www.youtube.com/watch?v=qelrVA3zeMc

Comments

Popular posts from this blog

Pyhton 3.4 - Continue

Conversations Ongoing: Valuing Modernization in Early European History

Conversations Ongoing: A Bunch of Amateurs