您好我有python编程题目想向您求助求大神指

2021-01-02 10:04:45 字数 4113 阅读 7473

1楼:匿名用户

^^#!/usr/bin/env python#-*- coding: utf-8 -*-from __future__ import with_statement

import re

values = {}

lines =

txt_file = 'data.txt'

out_file = 'result.txt'

data_re = re.***pile(ur'^(\w)\^(\w)\s+.+?\s+(.+?)\s*$')

with open(txt_file, 'ru') as f:

for line in f:

if '^' in line:

temp = data_re.findall(line)if temp != :

name1, name2 = temp[0][:2]if name1 != name2:

value = float(temp[0][-1])name = '%s^%s' % (name1, name2)if name not in values or values[name] < value:

values[name] = value

lines.insert(0, line.strip())with open(out_file, 'w') as f:

f.write('\n'.join(lines[:3]))

python编程题 30

2楼:

defformatit(x):

ifisinstance(x,int):

x=str(x)

return(''+x)[-2:]

defmain():

title=['s','m','t','w','th','f','s']

days=eval(input('enternumberofdays:'))

firstday=input('thefirstdayoftheweek:')

fd=title.index(firstday)

wts=

wt=['','','','','','','']#一个星期的模板

foriinrange(days):

wt[(i+fd)%7]=i+1

if(i+fd)%7==6:#如果满一个星期,

python较难编程题目 求大神 求源** 必有重谢

3楼:匿名用户

实现这些功能你觉得你能提供多大的报酬呢?

一道python题 求大神回答 感激不尽 10

4楼:匿名用户

deflink_zip(s,t):

p=pairnode(s.a,t.a,none)s1,t1,p1=s.nxt,t.nxt,p.nxtwhiles1andt1:

p1=pairnode(s1.a,t1.a,none)s1,t1,p1=s1.nxt,t1.nxt,p1.nxt

python基础,问题,跪求大神,感激不尽

5楼:大话残剑

输入部分e68a8462616964757a686964616f31333337616462

#-*-coding:utf8-*-

x=input("givemeoneof1,2or3:")

whiletrue:

ifx=='1'orx=='2'orx=='3':

break

print("invalidinput:"+x)

x=input("givemeoneof1,2or3:")

输入1、2、3,合计必须是25

#-*-coding:utf8-*-

sum=0

whiletrue:

x=input("givemeoneof1,2or3:")

ifx=='1'orx=='2'orx=='3':

ifsum+int(x)<=25:

sum+=int(x)

print("totalis"+str(sum))

ifsum==25:

break

else:

print("invalidinput:"+x)

执行结果

give me one of 1,2 or 3:5

invalid input: 5

give me one of 1,2 or 3:a

invalid input: a

give me one of 1,2 or 3:3

total is 3

give me one of 1,2 or 3:3

total is 6

give me one of 1,2 or 3:3

total is 9

give me one of 1,2 or 3:3

3total is 12

give me one of 1,2 or 3:

total is 15

give me one of 1,2 or 3:3

total is 18

give me one of 1,2 or 3:3

total is 21

give me one of 1,2 or 3:3

total is 24

give me one of 1,2 or 3:3

total is 24

give me one of 1,2 or 3:2

total is 24

give me one of 1,2 or 3:1

total is 25

求大神帮忙用python设计一个程序

6楼:

[项目计划]

第一周完成:

选题任务描述(程序的主要用途功能)

设计思路专描述

涵盖的主要知识点属

7楼:匿名用户

有递归,我感兴趣.

来嘛小妞,先开价

python编程题,大神速来,基础性题目,没学过的我不会,望大神给个小程序

8楼:冷叶忆雪

#-*-coding:gbk-*-from__future__importprint_function

defreverse_num(num):

print('输出:',end='')

if(num<0):

print('-',end='')

num=-num;

print_zero=false

whilenum>0:

ifprint_zero==true:

print(num%10,end='')elifnum%10!=0:

print_zero=true

print(num%10,end='')num/=10

print()

if__name__=='__main__':

num=int(raw_input('输入'))reverse_num(num)

求大神解释python的一段程序

9楼:

arr = # 初始化一来

个列表f = open(database) # 打开database文件

for line in f: # 从打开的文源件中逐行bai读取

temp = line.split(",") # 将读到的行按du","拆分为一个列表

mark = int(temp[9]) # 将拆zhi分的列表第

10楼:夜滔滔

用数组就可以做到了,二维数组

11楼:匿名用户

回去自己看看书吧,很简单的

请大神指教这道c语言的编程题目,一道c语言编程题,求大神指教!

1楼 string h是字符串库函数,当要引用字符串函数时,比如,strlen sizeof等函数时就必须要用string h库函数。 此题是计算现有字符串的长度和总长度,答案是 4,10,第一个4表示只有4个字符 a b c d 后面的10表示数组总长为10。 2楼 匿名用户 去k资讯看看吧!!!...