weekday=["Sunday","Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday"]
days=0
m_day=[31,28,31,30,31,30,31,31,30,31,30,31]
for i in range(2020):
if i%400 or (i%4==0 and i%100!=0):
days+=366
else:
days+=365
for k in range(11):
days+=m_day[k]
t_days=days+18+1 #2020-11-18
print(t_days%7)
......................
阅读全部
|
jywzf
贴于 2022年4月13日 20:43
hide
bbsi
age = int(input("Please input your age:\n"))
if age < 2:
print("原来你是个婴儿!!")
elif age < 4:
print("原来你是蹒跚学步,先等着过儿童节吧!!")
elif age < 20:
print("原来你是青少年,节日快乐!!")
elif age < 65:
print("原来你是成年人!!")
else:
print("原来你是老年人!!")
阅读全部
|
小呆阳
贴于 2022年3月28日 17:47
hide
bbsi
# 【程序1】
# 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
# 程序分析:python不用c语言那么麻烦,可以直接用内置的库函数得到结果
from itertools import permutations
perms = permutations([1,2,3,4], 3)
for perm in perms:
print(perm)
阅读全部
|
小呆阳
贴于 2022年3月28日 17:40
hide
bbsi
import turtle
t=turtle.Turtle()
t.penup()
t.goto(0,-50)
t.pendown()
t.begin_fill()
......................
阅读全部
|
xiaoyv2673
贴于 2022年3月23日 23:36
hide
bbsi
import os
import random
print(""" +++++++++++++++++游戏规则++++++++++++++++++++
++++++++++++++++++猜1到10之间的数字++++++++++++
++++++++++++++++注意:每次数字是随机的+++++++++""")
while True:
want = int(input('请输入你设定猜错失败次数的上线:'))
if want >10 or want<0:
print('你输入的不合理!')
continue
elif want !=23456789023456543:
if 5 > want and want > 2:
......................
阅读全部
|
小呆阳
贴于 2022年3月7日 17:50
hide
bbsi
height = input("你的身高是(m):")
print(height)
weight = input("你的体重是(kg):")
print(weight)
BMI=float(weight)/float(height)**2
print(f"你的BMI指数为:{BMI}")
if BMI<18.5:
print("你太瘦啦,美食可以放肆吃起来,哈哈哈哈~~~~")
elif BMI<24:
print("哇哦!你的状态非常健康哦,继续保持健康的生活习惯吧!")
......................
阅读全部
|
Lisa_lin
贴于 2022年2月21日 09:24
hide
bbsi
import RPi.CPIO as GPIO
from time import sleep
in1 = 24
in2 = 23
en = 25 # 定义输出引脚
temp1 = 1
GPIO.setmode(GPIO.BCM) # 定义树莓派gpio引脚以BCM方式编号
GPIO.setup(in1, GPIO.OUT)
GPIO.setup(in2, GPIO.OUT)
......................
阅读全部
|
斯玥
贴于 2022年2月16日 18:25
hide
bbsi
# -*- coding: UTF-8 -*-
import pymysql
def readSQL():
#查询 SQL 语句
sql = "SELECT id,'apiname',apiurl from apitest_apistep where apitest_apistep.Apitest_id = 2"
#打开 MySQL 数据库链接
coon = pymysql.connect(user='root', passwd = 'test123456',db = 'autotest', port = 3306, host='127.0.0.1',charset='utf8')
#获取数据库操作游标
cursor = coon.cursor()
#执行 MySQL 查询语句
aa = cursor.execute(sql)
......................
阅读全部
|
shlgj
贴于 2022年1月28日 14:50
hide
bbsi
#-*- coding:UTF-8 -*-
def wfile():
try:
filename = "C:\\Users\\zh\\"+"test.html"
except IOError:
print("file creat error")
else:
fp = open(filename,'wb')
fp.write('test'.encode('utf-8'))
fp.close()
......................
阅读全部
|
shlgj
贴于 2022年1月27日 19:45
hide
bbsi
#插入排序
def insertsort(li):
for index in range(1,len(li)):
value = li[index]
i = index -1
while(i>=0 and (value < li[i])):
li[i],li[i+1]=value,li[i]
i = i-1
li=[4,6,7,3,3,9,1]
......................
阅读全部
|
w13011201033
贴于 2022年1月1日 16:16
hide
bbsi