习题2.9-2.11.md

#逻辑错误
print("""
            Trust Fund Buddy
Totals your monthly spending so that your trust fund doesn't run out
(and you're forced to get a real job)

Please enter the requested,monthly costs.Since you're rich,ignore pennies
and use only dollar amounts.

"""
)

car = input("Lamborghini Tune-Ups:")        #input返回字符串
rent = input("Manhattan Apartment:")
jet = input("Private Jet Rental:")
gifts = input("Gifts:")
food = input("Dining Out:")
staff = input("Staff(buttlers,chef,driver,assistant):")
guru = input("Personal Guru and Coach:")
games = input("Computer Game:")

total = car + rent + jet + gifts + food + staff + guru + games

print("\nGrand Total:",total)

            Trust Fund Buddy
Totals your monthly spending so that your trust fund doesn't run out
(and you're forced to get a real job)

Please enter the requested,monthly costs.Since you're rich,ignore pennies
and use only dollar amounts.


Lamborghini Tune-Ups:5000
Manhattan Apartment:400000
Private Jet Rental:6000
Gifts:8000
Dining Out:9000
Staff(buttlers,chef,driver,assistant):10000
Personal Guru and Coach:6000
Computer Game:4000

Grand Total: 50004000006000800090001000060004000
# 转换数值类型
print("""
            Trust Fund Buddy
Totals your monthly spending so that your trust fund doesn't run out
(and you're forced to get a real job)

Please enter the requested,monthly costs.Since you're rich,ignore pennies
and use only dollar amounts.

"""
)

car = int(input("Lamborghini Tune-Ups:"))        #input返回字符串
rent = int(input("Manhattan Apartment:"))
jet = int(input("Private Jet Rental:"))
gifts = int(input("Gifts:"))
food = int(input("Dining Out:"))
staff = int(input("Staff(buttlers,chef,driver,assistant):"))
guru = int(input("Personal Guru and Coach:"))
games = int(input("Computer Game:"))

total = car + rent + jet + gifts + food + staff + guru + games

print("\nGrand Total:",total)

            Trust Fund Buddy
Totals your monthly spending so that your trust fund doesn't run out
(and you're forced to get a real job)

Please enter the requested,monthly costs.Since you're rich,ignore pennies
and use only dollar amounts.


Lamborghini Tune-Ups:10000
Manhattan Apartment:200000
Private Jet Rental:2220
Gifts:11000
Dining Out:54110
Staff(buttlers,chef,driver,assistant):211
Personal Guru and Coach:222554
Computer Game:111

Grand Total: 500206

在这里插入图片描述
在这里插入图片描述

name = input("Hi,What's your name?")

age = input("How old are you?")
age = int(age)

weight = int(input("Okay,last question.How many pounds do you weigh?"))

print("\nIf poet ee cummings were to email you,he'd adress you as",name.lower())
print("But if ee were mad,he'd call you %s"%(name.upper()))

called = name * 5
print("\n If a small child were trying to get your attention")
print("your name would become:")
print(called)

seconds = age * 365 * 24 * 60 * 60
print("\nYou're over %d seconds old."%seconds)

moon_weight = weight / 6
print("\nDid you know that on the moon you would weigh only %d pounds?"%moon_weight)

sun_weight = weight * 27.1
print("On the sun,you'd weigh %d pounds."%sun_weight)

Hi,What's your name?lzq
How old are you?23
Okay,last question.How many pounds do you weigh?60

If poet ee cummings were to email you,he'd adress you as lzq
But if ee were mad,he'd call you LZQ

 If a small child were trying to get your attention
your name would become:
lzqlzqlzqlzqlzq

You're over 725328000 seconds old.

Did you know that on the moon you would weigh only 10 pounds.
On the sun,you'd weigh 1626 pounds.

猜你喜欢

转载自blog.csdn.net/DMU_lzq1996/article/details/82938842
2.9