+ 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

10th Oct 2021, 1:21 PM
Chama Kazadi
Chama Kazadi - avatar
3 Respuestas
+ 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
10th Oct 2021, 1:29 PM
Ipang
+ 1
Thanks
10th Oct 2021, 1:37 PM
Chama Kazadi
Chama Kazadi - avatar
+ 1
Alternatives to creating a class are to use a dictionary or a pandas DataFrame.
10th Oct 2021, 2:09 PM
Simon Sauter
Simon Sauter - avatar