随笔分类 - Python_习题
摘要:作业一:打印10*10 星星 ★☆ 要求一:普通打印★ 1 l = 0 2 while l <10: 3 h = 0 4 while h < 9: 5 print("★", end=" ") 6 h += 1 7 print("★") 8 l+=1 1 # 打印 10 * 10 的星星表格 2 #
阅读全文
摘要:作业一 :任意一个数字列表,然后进行排序(冒泡排序) 方法一: 1 def test1(): 2 list1 = [1,23,4,6,8,55,2,9,90,35] 3 list1.sort() # sort()方法是对原列表进行排序 4 print(list1) 5 test1() 方法二: 1
阅读全文
摘要:作业一:三迁举办选“帅气男孩”,评委打分可以输入打分,要求分数必须大于5,小于10; 方法一 1 i = 1 2 while i < 6: 3 score = input("请%d评委打分:"%i) 4 if int(score) > 5 and int(score)<10: 5 print("感谢
阅读全文
摘要:作业一:将字符串”k:1/k1:2/k2:3/k3:4”处理成字典(比较难) 方法一 1 list = 'k:1/k1:2/k2:3/k3:4' 2 new_list = list.split("/") 3 print(new_list) 4 dic = {} 5 for i in new_list
阅读全文
摘要:1 def is_float(string): 2 string1 = str(string) 3 if string1.count('.') > 1: #检测字符串小数点的个数 4 return False 5 elif string1.isdigit(): #检测字符串是否只由数字组成,如果字符
阅读全文
摘要:1 weight = input("请输入体重:") 2 height = input("请输入身高:") 3 BMI = float(float(weight)/(float(height)**2)) 4 #计算bmi的公式 5 if BMI<= 18.5: 6 print("弱不禁风",BMI)
阅读全文
摘要:Python不支持以下哪种数据类型? A . char B . list C . complex D . float E. varchar 正确答案:A E python的变量没有固定的类型,可以用字符串表示 友情链接: python中break和continue的用法和区别详解
阅读全文

浙公网安备 33010602011771号