wlbk.net
当前位置:首页 >> Python作业 >>

Python作业

# -*- coding: utf-8 -*- TEXT = r''' The King and Queen of Hearts were seated on their throne when they arrived, with a great crowd assembled about them--all sorts of little birds and beasts, as well as the whole pack of cards: ...

用pandas创建一个dataframe,字段就是“学号”、“成绩分数”、“成绩等级” 你每录入一条数据,就往dataframe里写入一条,学号和分数是直接写进去的,等级就根据分数判断ABCDE后再写进去 查询的就是根据学号查就行了 如果把学号那个字段设为索引,查...

def question_1(): # Monday,Tuesday、Wednesday、Thursday、Friday、Saturday 、Sunday week_dic = {"m": "星期一", "tu": "星期二", "w": "星期三", "th": "星期四", "f": "星期五", "sa": "星期六", "su": "星期天", } x = str.lower(input(...

答案如下: #!/usr/bin/env python# -*- coding:utf-8 -*-# author: huozheshi2012# time : 2019/3/28import randomimport matplotlib.pyplot as pltdef roll_dice(): """ 模拟掷骰子 """ roll = random.randint(1, 6) return rolldef main(time...

def isPrime(num):for i in range(2,num-1):if(num%i==0):return 0return 1def fun1():for i in range(2,200):if(isPrime(i)):print("%d is prime number." %(i))def fun2():for i in range(2,200):isp=0for j in range(2,i-1):if(i%j==0):isp=1...

coinprice={"1分":1,"2分":2,"5分":5,"1角":10,"2角":20,"5角":50}coins=["5角","2角","1角","5分","2分","1分"]price=float(raw_input("请输入物品价格(元):"))if price>1 or price

SCRABBLE_LETTER_VALUES = { 'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4,...

from math import pir=float(input("input\n"))s=pi*r*rv=4/3*pi*r**3print("{:.2f} {:.2f}".format(s,v))

import functools def factorial(n): return functools.reduce(lambda x,y:x*y ,range(1,n+1)) def int_to_binary(n): bins='' if n==0:return '0' while n>0: bins+=str(n%2) n>>=1 return bins[::-1] def last_one(n): bins=int_to_binary(n)...

# encoding=UTF-8 ==>定义Python代码的编码为UTF-8# 石头剪子布 程序# 李忠import random ==>导入随机生成器 # 定义石头剪子布字典dict = {1:'剪子',2:'石头',3:'布'} ==>定义一个字典来保存数字和石头剪子布的对应关系 for row in dict: ==>遍...

网站首页 | 网站地图
All rights reserved Powered by www.wlbk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com