7-45 jmu-python-涨工资 (10 分),,输入一组工资数据,写
7-45 jmu-python-涨工资 (10 分),,输入一组工资数据,写
输入一组工资数据,写入列表。对于小于5000的工资,涨1.5倍。并输出涨后的工资数据。
输入格式:
数据之间空格隔开
输出格式:
涨工资后的数据,空格隔开。尾部 不带空格。
输入样例:
3000 4000 6000 8000 2000.5
输出样例:
4500.0 6000.0 6000 8000 3000.75
s = input()ls = []ls = s.split()cnt = 0for i in ls: i = float(i) if i <= 5000 and cnt == 1: if i - int(i) > 0: print(" {:.2f}".format(i * 1.5), end="") else : print(" {:.1f}".format(i*1.5),end="") elif i > 5000 and cnt == 1: print(" {:d}".format(int(i)),end="") if cnt == 0: if i <= 5000: if i - int(i) > 0: print("{:.2f}".format(i * 1.5), end="") cnt = 1 else: print("{:.1f}".format(i * 1.5), end="") cnt = 1 else: print("{:d}".format(int(i)), end="") cnt = 1
7-45 jmu-python-涨工资 (10 分)
相关内容
- Python3.4 asyncio模块简介,,这个模块提供了在单个
- pip install python 如何快速安装模块,,之前python安装
- Python用list和dict实现简单的用户管理系统(增、删、改
- python 文件操作读、写、追加的区别,,打开文件的常用
- python3.7: error while loading shared libraries: l,,python3.7:
- Mathab和Python的numpy中的维度顺序,,本文比较Matlab
- 我的python菜鸟之路3,,内存相关练习1的输出
- Python 比较两个字符串的相似度,,#METHOD11
- python1-集合、函数-(全局变量与局部变量),,集合#
- python中的标识符长度能有多长,,在python中,标
评论关闭