1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| >>> class Les :
def init (self):
self.ns={}
self.no = str(input("quoi?"))
def int(self):
self.x=int(intput("Combien?"))
i=0
nn=""
while(i<self.x):
nn=str(input("qui?"))
self.ns[nn]=int(input("Combien?"))
i+=1
def give(self):
self.et=[]
ny=0
self.my=0
for x,y in self.ns.items():
if y<7:
self.et.append(x)
else:
ny+=1
self.my+=y
self.my/=ny
>>> c1={}
>>> c2={}
>>> x=int(input("Combien?"))
SyntaxError: multiple statements found while compiling a single statement
>>> >>> i=0
>>> while (i<x):
l=Les()
l.int()
l.give()
c1[l.no]=l.my
c2[l.no]=l.et
i+=1
print(c1,c2) |
Partager