Skip to content

Calendula47/Python-Noob

 
 

Repository files navigation

Readme.md

本项目Python-Noob参考了《Python For Kids - A Playful Introduction to Programming》(Produced By Jason R. Briggs)按照《PFK lessonplans full》(nostarch.com/pfk) 完成的项目。

1. Hello World!

Activities:

Click Me To See The Lab1

2. Storing Things in Python

Activities:

Click Me To See The Lab2

3. Drawing with the Turtle

Activities:

Click Me To See The Lab3

4. Control Statements

Activities:

Click Me To See The lab4

5. Control Statements

Activities:

Click Me To See The Lab5

6. Code Reuse

Activities:

Click Me To See The Lab6

7. Price Question

问题如下:

用Python语言实现:
使用10吨水以下每吨水收取1.5元;使用50吨以下,超过10吨的部分每吨3元;使用超过50吨水,超过部分每吨水收取4元

E.G.
Input:100
Output:335元

具体代码如下

def cal():
    q=float(input("请输入用水(吨):"))
    if q<0:
        print("Error:Invalid Number!")
    elif q>=0 and q<=10:
        price=q*1.5
        print(price);print("元")
    elif q>10 and q<=50:
       price=3*q-15
       print(price);print("元")
    elif q>50:
       price=4*q-65
       print(price);print("元")
x=0
while x==0:
    cal()

Click Me To See The Price Question

END

About

菜鸟的Python之旅

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%