摘要:
1、字符串逆序输出 print(input()[::-1]) 2、子字符串输出 name = 'python语言程序设计' print(name[:6]) print(name[-6:]) 3、字符串长度 a = input() print(len(a)) 4、分类统计字符 str = input( 阅读全文
posted @ 2020-04-13 18:36
树懒君
阅读(226)
评论(0)
推荐(0)
摘要:
1、鸡兔同笼 程序设计题 n = eval(input()) l = list() for k in range(n): a = int(input()) if (a%2) != 0: min = max = 0 else: j = int(a/4) i = a%4 m = int(i/2) min 阅读全文
posted @ 2020-04-13 18:30
树懒君
阅读(278)
评论(0)
推荐(0)
摘要:
1、画五角星 import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill() for i in range(5): turtle.forward(100) tu 阅读全文
posted @ 2020-04-13 18:26
树懒君
阅读(238)
评论(0)
推荐(0)
摘要:
1.青蛙跳台阶 def f(n): t1=1 t2=2 s=0 for i in range(3,n+1): s=t1+t2 t1=t2 t2=s return s def jump(n): if n<=2: return n else: return f(n) n = eval(input()) 阅读全文
posted @ 2020-04-13 18:15
树懒君
阅读(254)
评论(0)
推荐(0)
摘要:
1、一元二次方程求根 import math a = eval(input()) b = eval(input()) c = eval(input()) d = pow(b,2)-4*a*c if a == 0: if b == 0: print('Data error!') else: print 阅读全文
posted @ 2020-04-13 18:07
树懒君
阅读(258)
评论(0)
推荐(0)