首页 >>  正文

大一python编程题库和答案

来源:baiyundou.net   日期:2024-08-23

侯孙毓2478python核心编程第二版第二章练习题2 - 11 出现下面错误 求解?(原谅我是小白,很白的那种)?? -
郎初吕13417776800 ______ 三句print后面少了一个括号.print('please input number %d'%(i+1)) print('please input number %d'%(i+1)) print(''' ..... ''') 另外sum函数是内置顶级函数,你定义的函数会覆盖内置的函数,建议改名.建议以后用PyCharm之类的IDE编程,这样会有代码提示,不过新手纯输入代码对提高代码的印象有好处.

侯孙毓2478python编程.在冬天一个单位打折,买一件商品打9折,两件8折3件7折,4件6折,写一个程序可以 -
郎初吕13417776800 ______ #首先设置未知数 amount = 0 total_cost = 0 money_saved = 0 #设置输入 price = input (“输入价格”:) while price > 0: total_cost = total_cost + price amount +=1 if amount < 4: total_off = total_cost * (1- amount/10.00) #如果有变量 else: total_off =...

侯孙毓2478高手求教~~~关于python编程的题目: -
郎初吕13417776800 ______ 看没人理你..怪可怜的,,,就帮你做好了...看代码#! /usr/bin/env python#coding=utf-8''' Created on 2011-1-29 @author: qihigh''' class baiduAns: __fruitLeft = 20 __buyDay = 5 __x = None __y = None def __init__(self, x, y): self.__x = x ...

侯孙毓2478python编程,把一个整数list分成两个list,要求两个(list里整数总和)之差值最小 -
郎初吕13417776800 ______ #!/usr/bin/env python #-*- encoding: utf-8 -*- from itertools import compress, imap def fun(lst): min_number = 100000000 length = len(lst) total = 2**length record = None f = lambda x:compress(lst, imap(int,bin(x)[2:].rjust(length,'0'))) for n in xrange(...

侯孙毓2478Python编程的问题,输入一个第一象限的点,一个第三象限的点,计算两点间的距离 -
郎初吕13417776800 ______ def distance(x1,y1,x3,y3): return ((x1-x3)**2 + (y1-y3)**2)**0.5>>> distance(1,1,-1,-1)2.8284271247461903>>> distance(3,4,-3,-4)10.0 这个不局限第几象限,随意2点的坐标都可以.

侯孙毓2478第一题、 编写程序:对100个数组元素依次赋值为:0, 2, 4……198,要求按逆序输出 -
郎初吕13417776800 ______ /* 对100个数组元素依次赋值为:0, 2, 4……198,要求按逆序输出,并且每行输出10个数字 */ #include "stdio.h" void main() { int arr[100]; int i; for(i=0; i<100; i++) arr[i] = 2 * i; for(i=99; i>=0; i--) { printf("%4d", arr[i]); if(i%10 == 0) printf("\...

侯孙毓2478大一编程题 -
郎初吕13417776800 ______ #include char tohex(int n){ if(n>=10 =15) { return 'A'+n-10; } return '0'+n;}void dec2hex(int n,char *buf){ int i=0; int mod; while(n) ...

侯孙毓2478求一段Python编程语言 求设计一段Python编程语言,解答下列问题. 输入两个点,建立起直线 -
郎初吕13417776800 ______ 回炉了一下几何,图形学用到 import math class Point: def __init__(self): self.x=0 self.y=0 def input(self,pname): self.x=int(input("Enter the x of point {0}: ".format(pname))) self.y=int(input("Enter the y of point {0}: ".format(pname))) a=Point() ...

侯孙毓2478用python编程更新一个电子表格 -
郎初吕13417776800 ______ 循环遍历A,找到Garlic Celery 和lemons 写入B字段,读取出C字段, D=B*C...........

(编辑:自媒体)
关于我们 | 客户服务 | 服务条款 | 联系我们 | 免责声明 | 网站地图 @ 白云都 2024