def定义函数def sayhello(): print(“hello world”) sayhello() 如何做传入参数的做法def max(a,b): if a>b: reture a else: ...
打印1到100的数for i in range(0,100): print(i) fruits = [‘banana’, ‘apple’, ‘mango’]for fruit in fruits: print (‘当前水果: %s’% f...
score = 90if score >= 80: print(“很好”)elif score >= 60: print(“及格”)elif score >= 30: print(不及格):else: print(“很差”)
变量名只有在第一次出现的时候,才是定义变量。当再次出现时,不是定义变量,而是直接使用之前定义的变量。1.变量命名1)命名的规范性变量名可以包括字母、数字、下划线,但是数字不能做为开头。例如:name1是合法变量名,而1name就不可以。系统关键字不能...
输入print(‘Hello World’),并右击空白处,选择Run运行,表示打印一个字符串”Hello World!”。 print(‘hello,world’)