- 博客(10)
- 收藏
- 关注
原创 C 冒泡排序
int n, buf;q < n-1;q++)i < n-1-q;i++)buf = a[i];else;j < n;j++)return 0;
2023-11-03 11:23:34
133
原创 c++ 罗马数字转正常数字
#include<iostream>#include<cstring>#include<string>#include<cstdio>using namespace std;void fun(char str1[]){ int sum,a; a = strlen(str1); for(int i=0;i<=a;i++) { if(str1[i]=='I') {...
2022-05-18 08:24:24
745
原创 一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多少
from functools import reduceh = 100s = []for count in range(10): h = h/2 s.append(h) sum = reduce(lambda x,y:x+y,s)print(s)print(sum)
2021-10-29 17:22:07
331
原创 写一个函数,求三个数和的平均值。
def printo(): a=int(input("第一个数")) b=int(input("第二个数")) c=int(input("第三个数")) d = a+b+c average = d//3 print(average)printo()
2021-10-28 17:39:49
2020
原创 写一个函数,求三个数的和.
def printo(): a=int(input("第一个数")) b=int(input("第二个数")) c=int(input("第三个数")) d = a+b+c print(d)printo()
2021-10-28 17:36:53
2824
原创 写一个函数,可以通过输入的参数,打印出自定义行数的横线。
def printo(): print("------------------")n = int(input("请输入需要的横线数:"))count = 1while n >= count: printo() count+=1if n < count: exit()
2021-10-28 17:31:37
1557
原创 通过index.()的方法找到第二个‘eva‘的值并将其改成‘EVA‘
names = ['金角大王', '黑姑娘', 'rain', 'eva', '狗蛋', '银角大王', 'eva']first_index = names.index('eva')new_list = names[first_index+1:]second_index = new_list.index('eva')location = (first_index+second_index+1)names[location] = 'EVA'print(names)print(location).
2021-10-05 13:21:19
327
原创 python取出列表下标为偶数的元素。
names = ['金角大王', '黑姑娘', 'rain', 'eva', '狗蛋', '银角大王', 'eva']count = 0for i in names: names.index(i) == count while count<6 : if count %2 == 1: print(names[count]) count += 1
2021-10-05 12:56:45
6632
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人