# python2103b

> 据说是黄淮学院数应2103B,python必考的题,可能不会考

Latest version **1.0.0** (published 2022-08-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install python2103b
pnpm add python2103b
yarn add python2103b
bun add python2103b
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-08-07 |
| First published | 2022-08-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 730 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | DAIKANGSHENG |
| Maintainers | daikangsheng |

## Links

- npm: https://www.npmjs.com/package/python2103b
- npm.io page: https://npm.io/package/python2103b

## Recent versions

- 1.0.0 (latest) — 2022-08-07

## README

##    四个python文件对应四个题，看图片，据说要考
_**自己调试一下**_
## 1，请定义一个Dog类，类属性有名字（name）毛发（color）体重（weight）方法叫（wangwang）调用该方法时输出wangwang,使用Dog类创建一个对象，名字为旺财，毛色为黄色，体重为10，并调用wangwang方法
```python
class Dog:
    def __init__(self,name,color,weight):
        self.name=name
        self.color=color
        self.weight=weight
    def wangwang(self):
        print("wang!wang!")
d= Dog("旺财","黄色",10)
d.wangwang()
print(d.name)
print(d.color)
print(d.weight)
```
## 2,编写程序，定义一个Circle类，有属性半径，get_circumference（）,计算并输出圆的周长，方法get_area（）计算并输出圆的面积。创建好类后，创建一个圆对象进行测试
```python
class Circle:
    def __init__(self,r):
        self.r=r
    def get_circumference(self):
        l=2*3.14*self.r
        print(l)
    def get_area(self):
        s=3.14*self.r*self.r
        print(s)
c=Circle(10)
c.get_circumference()
c.get_area()
```
## 3,编写一个猜数游戏
```python
import tkinter as tk
import random
x=random.randint(0,100)
def f():
    guess=int(en.get())
    if x==guess:
        la.config(text=f"恭喜你猜对了")
    elif x>guess:
        la.config(text="很遗憾，你猜小了")
    else:
        la.config(text=f"很遗憾，你猜大了")
def g():
    pass
root=tk.Tk()
root.title("猜数游戏")
la=tk.Label(text="请输入0-100之间任意整数:")
en=tk.Entry(root)
la.pack(side=tk.TOP)
en.pack(side=tk.LEFT)
tk.Button(text="猜",width=20,command=f).pack(side=tk.LEFT)
tk.Button(text="关闭",width=20,command=g).pack(side=tk.LEFT)
root.mainloop()
```
## 4,求e的近似值
```python
def factoria(n):
    if n==1:
        return 1
    return n*factoria(n-1)
def calculate_e(m):
    e=1
    while m:
        t=factoria(m)
        e=e+1/t
        m-=1
    print(e)
m=int(input("请输入循环次数m:"))
calculate_e(m)
```
```

---
_Source: https://npm.io/package/python2103b · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
