SHARE
TWEET

Untitled

a guest Oct 16th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open("planets.txt").read().splitlines()
  2. open("planets.txt").read().splitlines()
  3. [x for x in lines if x != '']
  4. open("numbers.txt").read().splitlines()
  5. [float(x) for x in lines if x != '']
  6. (sum(numbers)/len(numbers))
  7. John,66.3,170.2
  8. Jane,54.1,162.8
  9. Jimmy,89.5,179.8
  10. ['John',66.3,170.2],
  11. ['Jane',54.1,162.8],
  12. ['Jimmy',89.5,179.8]
  13. file = input("Enter score file: ")
  14. data = open(file).read().splitlines()
  15. numbers = [float(x) for x in data if x != ""]
  16. AVG = sum(numbers)/len(numbers)
  17. MAX = max(numbers)
  18. MIN = min(numbers)
  19. for i in range(len(numbers)):
  20.     print(f"Student #{i+1} score: {numbers[i]:.0f}")
  21.    
  22. print(f"Average score is {AVG:.2f}")
  23. print(f"Minimum score is {MIN:.0f}")
  24. print(f"Maximum score is {MAX:.0f}")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top