Python实验题目,求助大佬,求大佬!请问一道python题目,求助!

2021-01-02 10:04:44 字数 4758 阅读 5773

1楼:故事

以下是**:

all_tuple =

sum_stu = int(input('请输入一共有多少个学生:'))

while(sum_stu>0):

a = input('请输入学生名字:')

class1 = float(input('第一门课

的成绩:'))

class2 = float(input('第二门课的成绩:'))

class3 = float(input('第三门课的成绩:'))

score = class1 + class2 + class3

mid = score/3

one_tuple = (a,class1,class2,class3,mid,score)

sum_stu -= 1

sorted_list = sorted(all_tuple,key=lambda x:x[5],reverse=true)

sum_stu = 1

for i in sorted_list:

print('第',sum_stu,'名',i[0],':',end='')

print('平均分:',i[4],',总分:',i[5])

sum_stu += 1

求大佬!请问一道python题目,求助!

2楼:

使用集合,首先分别创建1,2,3科目的集合,使用并集算出人数后用总人数减去求出第一题

第二题,第三题同理

求助大佬,这个python作业的**要怎么写?

3楼:匿名用户

f = open("test.txt", 'wb') # 二进制写模式

f.write(b'precious things are very few!') # 二进制写

f.write(b'i wish you success in your work!') # 二进制写

f.write(b'with the ***pliments of the season!') # 二进制写

f.write(b'may joy and health be with you always!') # 二进制写

f.write(b'a friend is a loving ***panion at all times!') # 二进制写

f.close() # 关闭文件

f = open("test.txt", 'rb') # 二进制读

print(f.read()) # 打印读出来的数据

f.close() # 关闭文件

4楼:匿名用户

ss = '''precious things are very few!

i wish you success in your work!

with the ***pliments of the season!

may joy and health be with you always!

a friend is a loving ***panion at all times!'''

with open('./exp030202.txt','wb',encoding='utf-8') as file1:

file1.write(ss)

with open('./exp030202.txt','rb',encoding='utf-8') as file2:

print(file2.read())

5楼:我配合的演出

in [4]: with open(r'e:/exp030202.txt','wb') as t:

...: t.write(ss.encode())...:

...:

in [5]: with open(r'e:/exp030202.txt','rb') as t:

...: print(t.read())...:

6楼:格蓝英奇

s = """precious things are very few!

i wish you success in your work!

with the ***pliments of the season!

may joy and health be with you always!

a friend is a loving ***panion at all times!"""

with open('exp030202.txt', 'wb')as f:

f.write(s.encode('utf-8','strict'))

f.close()

with open('exp030202.txt', 'rb')as f:

read_data = f.read()

print(read_data)

f.close()效果图

求助大佬,这个python作业的**要怎么写?

7楼:格蓝英奇

效果图我看题目没有回说要类型转

答换的就没有转换,有问题继续追问

请问大佬,这道python题目应该怎么写?

8楼:匿名用户

try:

如果有读取文件

except filenotfounderror:

如果没有可读取文件

求助python大佬

9楼:匿名用户

用replace就好了

10楼:匿名用户

可以使用 sub 方法, 非常优雅的实现。

python问题。求助大佬 50

11楼:大地广场舞

else:

print('ghh')

#elsesum>4:这个**写错了

12楼:匿名用户

应该是elif sum > 4:

另外,不要用系统关键字做变量

13楼:【掌天

上面的回答只说了你的错误,其实你这样写,else压根进不去,内应该这样写容

sum=0

whiletrue:

name=...

password=...

if...:

print...

break

else:

ifsum<=4:

...else:

...break

14楼:宇称

计算1加到100:求采纳

python题目求大佬教

15楼:英语好难学

list_weather=[["周一","11℃","26℃","1级","优"],["周二","16℃","26℃","1级","优"],["周三","16℃","20℃","1级","优"],["周四","16℃","26℃","1级","优"]]

excellent_list=[x[0]forxinlist_weatherifx[-1]=='优']

print("空气为优的天数:{},它们分别是:".format(len(excellent_list)),end="")

foriinexcellent_list:

ifi==excellent_list[-1]:

print(i,'\n')

else:

print(i+",",end="")

wind_list=[x[0]forxinlist_weatherifint(x[2][0:-1])<=25andint(x[-2][0])<3]

print("风力低于3级且最高气温不超过25℃的天数是{},分别是:".format(len(wind_list)),end="")

foriinwind_list:

ifi==wind_list[-1]:

print(i,'\n')

else:

print(i+",",end="")

temperature_list=[x[0]forxinlist_weatherifint(x[2][0:-1])+int(x[1][0:-1])<=40]

print("平均气温低于20℃的天数是{},分别是:".format(len(temperature_list)),end="")

foriintemperature_list:

ifi==temperature_list[-1]:

print(i,'\n')

else:

print(i+",",end="")

python**,向大佬求助 50

16楼:偟弑

a=int(input())

b=int(input())

c=int(input())

p=(a+b+c)/2

s=(p*(p-a)*(p-b)*(p-c))**0.5print("%.2f"%s)

第五行s那个是小括号

如果abc都在

版一行要用

权split

JAVA编程题求大佬求助,JAVA编程题求大佬求助 10

1楼 仲甫 你是刚开始学习编程吧,这是java的基础啦,类的属性和方法都给你抽象出来了,你新建这三个类,然后写个测试类,将你创建的类实例化,调用方法实现就好啦。 2楼 来自褒禅山的小 臣妾才只能看懂简单对象 3楼 歇盲番摈腿 题目太深,本宫做不到 4楼 匿名用户 我可以帮你 我是软件的 看我简介 找...

Python问题,求大神,Python问题,求大神 20

1楼 匿名用户 def up limit x y return pow x y 1 def decimal2binary x x binary bin x return x binary 2 def main data length limit up limit 2 length if data l...

python问题求大神解,Python问题,求大神解答

1楼 日time寸 可以使用scipy io wavefile中的write函数,示例 如下 from scipy io wavfile import writefrom numpy import randomfilename g meelo wav rate 44100 data random r...