python week1.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python week1.py相关的知识,希望对你有一定的参考价值。

# initialize important data
jugCurrentVolume = 0

# ask user for jug capacity
jugCapacity = input("Enter jug capacity: ")

# ask user for tube capacity
tubeCapacity = input("Enter tube capacity: ")

# while there is still space for another tube
while (jugCurrentVolume + tubeCapacity <= jugCapacity):
    
    # pour water in
    jugCurrentVolume = jugCurrentVolume + tubeCapacity
    
    # tell user I poured and the amount inside jug
    print("Jug has %dmL now" % (jugCurrentVolume))
    
# if jug is filled
if (jugCurrentVolume == jugCapacity):

    # tell user rock and roll
    print("Rock n Roll")
    
# or else
else:
    
    # tell user the amount of space left
    print("Jug have %dmL left" % (jugCapacity - jugCurrentVolume))

以上是关于python week1.py的主要内容,如果未能解决你的问题,请参考以下文章

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍

Python学习之认识python