用python编写一个点餐程序
@督成832:用python编写一个程序 -
熊居15640538883…… lst_q = [3, -4, 1, 0, -1, 0, 5, 7, -9, -1000] lst_negative = [] lst_zero = [] lst_positive = [] for i in lst_q: if i lst_negative.append(i) elif i == 0: lst_zero.append(i) else: lst_positive.append(i) print(lst_negative) print(lst_zero) print(lst_positive) 》》》》[-4, -1, -9, -1000] [0, 0] [3, 1, 5, 7]
@督成832:用python写一个程序 -
熊居15640538883…… 其实这个不难,以下代码做个参考吧.#-*-coding:utf-8-*- class Student(object): """ 自定义Student类 """ def __init__(self, name, score): # 初始化Student,参数name,score self.name = name self.score = score def __cmp__(self, other):...
@督成832:用python编程语言怎么写一百个馒头和一百个和尚?? -
熊居15640538883…… 用循环 a=0 for (a<100): a=a+1 print('和尚馒头')
@督成832:python题编写一个程序,接收用户的输入并存入一个列表,再编写一个函数,将用户的输入列表作为参数, -
熊居15640538883…… L = [] while 1: s = input('Please input your information:') if s == ' ': break else: L.append(s)def funcrepeat(L): if list(set(L)) == L: print("你的输入没有重复值") else: print("你的输入有重复值") print(L)funcrepeat(L)
@督成832:如何用Python写一个每分每时每天的定时程序 -
熊居15640538883…… a.我们先获取当前的时间 now=datetime.datetime.now() 假设当前时间是2017-02-09 20:19:47.555000 b.然后我们输入一个你要定时执行的target时间 比如你是x分10秒的时候执行sched_Timer=datetime.datetime(x,x,x,x,x,10) 前面的x是并不重要...
@督成832:如何在Windows环境下运行Python脚本 -
熊居15640538883…… python是一款应用非常广泛的脚本程序语言,谷歌公司的网页就是用python编写.python在生物信息、统计、网页制作、计算等多个领域都体现出了强大的功能.python和其他脚本语言如java、R、Perl 一样,都可以直接在命令行里运行脚本程序...
@督成832:怎么用python写一个1+2+3+...n的程序? -
熊居15640538883…… for i in xrange(0,21): for j in xrange(0,51): if i*5+j*2<=100: print i, j, 100-i*5-j*2
@督成832:用python编写一个程序,输出你的姓名和学号 -
熊居15640538883…… 代码如下: name = input('请输入你的姓名:')number = input('请输入你的学号:')print('你的姓名:', name)print('你的学号:', number)
@督成832:如何用pycharm快速编辑一段python程序 -
熊居15640538883…… 1 create new project:2 右键该项目|new|python file:3 编辑 python 代码:4 右键|点击运行:5 看到运行结果:
@督成832:怎样用python写一个串口程序 -
熊居15640538883…… 解决方法如下: import serial ser = serial.Serial() # open 'COM1', baudrate=9600, etc ser.write('string out') ser.read(1) # read 1 byte from COM port # ... ser.close()
熊居15640538883…… lst_q = [3, -4, 1, 0, -1, 0, 5, 7, -9, -1000] lst_negative = [] lst_zero = [] lst_positive = [] for i in lst_q: if i lst_negative.append(i) elif i == 0: lst_zero.append(i) else: lst_positive.append(i) print(lst_negative) print(lst_zero) print(lst_positive) 》》》》[-4, -1, -9, -1000] [0, 0] [3, 1, 5, 7]
@督成832:用python写一个程序 -
熊居15640538883…… 其实这个不难,以下代码做个参考吧.#-*-coding:utf-8-*- class Student(object): """ 自定义Student类 """ def __init__(self, name, score): # 初始化Student,参数name,score self.name = name self.score = score def __cmp__(self, other):...
@督成832:用python编程语言怎么写一百个馒头和一百个和尚?? -
熊居15640538883…… 用循环 a=0 for (a<100): a=a+1 print('和尚馒头')
@督成832:python题编写一个程序,接收用户的输入并存入一个列表,再编写一个函数,将用户的输入列表作为参数, -
熊居15640538883…… L = [] while 1: s = input('Please input your information:') if s == ' ': break else: L.append(s)def funcrepeat(L): if list(set(L)) == L: print("你的输入没有重复值") else: print("你的输入有重复值") print(L)funcrepeat(L)
@督成832:如何用Python写一个每分每时每天的定时程序 -
熊居15640538883…… a.我们先获取当前的时间 now=datetime.datetime.now() 假设当前时间是2017-02-09 20:19:47.555000 b.然后我们输入一个你要定时执行的target时间 比如你是x分10秒的时候执行sched_Timer=datetime.datetime(x,x,x,x,x,10) 前面的x是并不重要...
@督成832:如何在Windows环境下运行Python脚本 -
熊居15640538883…… python是一款应用非常广泛的脚本程序语言,谷歌公司的网页就是用python编写.python在生物信息、统计、网页制作、计算等多个领域都体现出了强大的功能.python和其他脚本语言如java、R、Perl 一样,都可以直接在命令行里运行脚本程序...
@督成832:怎么用python写一个1+2+3+...n的程序? -
熊居15640538883…… for i in xrange(0,21): for j in xrange(0,51): if i*5+j*2<=100: print i, j, 100-i*5-j*2
@督成832:用python编写一个程序,输出你的姓名和学号 -
熊居15640538883…… 代码如下: name = input('请输入你的姓名:')number = input('请输入你的学号:')print('你的姓名:', name)print('你的学号:', number)
@督成832:如何用pycharm快速编辑一段python程序 -
熊居15640538883…… 1 create new project:2 右键该项目|new|python file:3 编辑 python 代码:4 右键|点击运行:5 看到运行结果:
@督成832:怎样用python写一个串口程序 -
熊居15640538883…… 解决方法如下: import serial ser = serial.Serial() # open 'COM1', baudrate=9600, etc ser.write('string out') ser.read(1) # read 1 byte from COM port # ... ser.close()