#include<stdio.h> int volume(int a, int b,int c)/*定义函数*/ { int p; p = a * b * c; return p; } int main() { int a, b, c,v; printf("请输入长方体的长.宽和高:\n"); scanf_s("%d%d%d", &a, &b, &c); v = volume(a, b, c); printf("体积=%
def new_op_file(filename,content=None): f = open(filename,'a+') f.seek(0) if content: #非空即真,如果有内容就往下运行 f.truncate()#清空文件 f.write(str(content))#write只能写入字符串,所以需要转化为str res = ''#写入操作,所以返回是空 else: res = eval(f.read())#将读到的字符串转化为原来的数据格式 f.close() return
#!/usr/bin/python # 导入math包 import math def quadratic(a, b, c): if not isinstance(a, (int, float))and isinstance(a, (int, float)) and isinstance(a, (int, float)): raise TypeError('a or b or c must be a number') dt = int(b) ** 2-(4*int(a)*int(c)) if a
def abc(str,data): count = [] numMax = 0 for a in range(len(str)): if a == 0: temp = str.find(data, numMax, len(str)) else: temp = str.find(data, numMax+1, len(str)) if temp != -1: for i in range(len(data)): count.append(temp + i) elif numMax == 0 an