简单的Python大学数学课程 [英] Simple Python college math program

查看:79
本文介绍了简单的Python大学数学课程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Peggy以5.0%的佣金率上市房地产。 Peggy的经纪人将获得一半的佣金,Peggy的份额将是其中的一半。该物业出售时减少20%。编写一个程序,提示列表的原始价格。您的程序应该以货币格式输出降低的销售价格和佩吉的佣金,并在第一位和小数点后两位加上$符号。另外,显示相应金额超过$ 1,000的逗号。



在python中编程最简单的方法是什么?

这是可怕的到目前为止基本的伪代码



我尝试过:



Peggy listed a real estate property for a commission rate of 5.0%. Peggy’s brokerage will get half of the commission and Peggy’s share will be half of that. The property sells when reduced by 20%. Write a program that prompts for the original price of the listing. Your program should output the reduced selling price and Peggy’s commission in currency format with the $ sign right up against the first digit and two decimal places. Also, display commas as appropriate for amounts over $1,000.

whats the most minimal way to program this in python?
this is the horrible basic psuedocode i got so far

What I have tried:

import locale
origpr = input('what is the original price')# original full price 
discopr = int(origpr * 0.80) #answer to the property sells when reduced by 20%
comish = int(discopr * 0.05)#newprice times .05
broker = int(comish *.5)#brokers half the comission
peggy = int(broker *.5) #peggys comish
print'the discounted price is $'+format(discopr,'.2f')#print the reduced 
print'Peggys comission is $'+format(peggy,'.2f')#print the reduced 

推荐答案

在第一个数字和两个小数位右对齐。另外,显示相应数量的逗号
sign right up against the first digit and two decimal places. Also, display commas as appropriate for amounts over


1,000。



在python中编程最简单的方法是什么?

这是我到目前为止可怕的基本伪代码



我尝试了什么:



1,000.

whats the most minimal way to program this in python?
this is the horrible basic psuedocode i got so far

What I have tried:

import locale
origpr = input('what is the original price')# original full price 
discopr = int(origpr * 0.80) #answer to the property sells when reduced by 20%
comish = int(discopr * 0.05)#newprice times .05
broker = int(comish *.5)#brokers half the comission
peggy = int(broker *.5) #peggys comish
print'the discounted price is


' +格式(discopr,' .2f' 打印缩小的
print ' Peggys comission是
'+format(discopr,'.2f')#print the reduced print'Peggys comission is


这篇关于简单的Python大学数学课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆