'''
Q7. Open "last.txt" file with read-only file mode
Count the numbers larger than 0.1 assign it to "ans7" variable
'''
# Note: Please be careful with names and numbers. To compare
numbers to 0.1, it should be float not string.
# But, names cannot be converted to float...
# Hint: You can create two lists which respectively have names and
numbers.
# Then you can use a list having numbers to compare to 0.1
1 SMITH 0.88085 2 JOHNSON 0.68844 3 WILLIAMS 0.56866 4. BROWN 0.51162 5 JONES 0.50517 6 MILLER 0.41807 7 DAVIS 0.39751 8 GARCIA 0.31817 9 RODRIGUEZ 0.29813 10 WILSON 0.29027 11 MARTINEZ 0.28732 12 ANDERSON 0.28262 13 TAYLOR 0.26704 14 THOMAS 0.26345 15 HERNANDEZ 0.26185 16 MOORE 0.259 17 MARTIN 0.24937 18 JACKSON 0.24693 19 THOMPSON 0.23887 20 WHITE 0.23707 21 LOPEZ 0.2304 22 LEE 0.22459 23 GONZALEZ 0.22157 24 HARRIS-0.22002 25 CLARK 0.20328 26 LEWIS 0.18903 27 ROBINSON 0.18647 28 WALKER 0.18583 29 PEREZ 0.18109 30 HALL 0.17555 31 YOUNG 0.17273 32 ALLEN0.17177 33 SANCHEZ 0.16357 34 WRIGHT 0.16324 35 KING 0.16273 36 SCOTT 0.15573 37 GREEN 0.15327 Dn
''' Q7. Open "last.txt" file with read-only file mode Count the numbers larger than 0.1 assign it to "ans7" variable '''
-
- Site Admin
- Posts: 899559
- Joined: Mon Aug 02, 2021 8:13 am