Giter VIP home page Giter VIP logo

car's People

car's Issues

猜數字

import random
start = input("請隨決定機數字範圍開始值: ")
end = input("請隨機決定數字結束值")
start = int(start)
end = int(end)

r = random.randint(start, end)
count = 0
while True:
count += 1 # count = count +1
num = input("請猜數字: ")
num = int(num)
if num == r:
print("你猜中了!!")
break
elif num > r:
print("比答案大")
elif num < r:
print("比答案小")
print("這是你猜的第", count, "次")

BMI

height = input('請輸入身高(cm): ')
weight = input('請輸入體重(kg): ')
height = int(height)
weight = int(weight)
height = height / 100 # 換成公尺
bmi = weight / height / height
if bmi < 18.5:
print('你的bmi值為', bmi, '屬體重過輕')
elif bmi >= 18.5 and bmi < 24:
print('你的bmi值為', bmi, '屬正常範圍')
elif bmi >= 24 and bmi < 27:
print('你的bmi值為', bmi, '稍重')
elif bmi >= 27 and bmi < 30:
print('你的bmi值為', bmi, '輕度肥胖')
elif bmi >= 30 and bmi < 35:
print('你的bmi值為', bmi, '中度肥胖')
elif bmi >= 35: # 寫else: 也可以
print('你的bmi值為', bmi, '重度肥胖')

作業

country = input("請問你是哪國人?")
age = input("請輸入年齡: ")
age = int(age)
if country == "台灣":
if age >= 18:
print("你可以考駕照")
else:
print("你還不能考駕照")

年齡

else if 另外如果

age = input("請輸入年䶖: ")
age = int(age)
if age < 13:
print("國小")
elif age >= 13 and age < 18:
print("國高中")
elif age >= 18 and age < 22:
print("大學")
else:
print("社會人士")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.