类型转换;运算符

#逻辑错误
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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值