+ 1
1.How to show people that are above 20 yrs and got 10 points and above? Display people's names above 32?
name = [] points = [] age = [] count = 1 while count <=20: n = input("name:") name.append (n) p = float(input("points:")) points.append(p) a = int(input("age:")) age.append(a) count = count + 1
3 Réponses
+ 3
You need to have a class having 'name', 'points' and 'age' attributes.
Make a `list` to contain objects of that class, read and assign values to the attributes.
Then you can use built-in function filter() to filter matches from the `list`.
P.S. Please tag Python ☝
* Tags had been updated
+ 1
Thanks
+ 1
Alternatives to creating a class are to use a dictionary or a pandas DataFrame.