Advertisement
patryk

KCK - LAB 1

Oct 6th, 2015
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. #def czy_parzysta(liczba):
  2. #       if liczba % 2 == 0:
  3. #               print("parzysta")
  4. #       else:
  5. #               print("nieparzysta")
  6. #
  7. #   for x in range(20):
  8. #       czy_parzysta(x)
  9.  
  10. ###
  11.  
  12. #sentence = "the quick brown fox jumps over the lazy cat"
  13. #words = sentence.split()
  14. #word_lengths = [len(word) for word in words if word != "the"]
  15. #print(word_lengths)
  16.  
  17. ###
  18.  
  19. #x, z = 2, 3
  20. #z = [str((x**2, z*3)) for x in range(10) for z in range(7)]
  21. #print("\n".join(z))
  22.  
  23. ###
  24.  
  25. #z = [(x, y) for x in range(10) for y in range(10) if x!=y]
  26. #print(z)
  27.  
  28. ###
  29.  
  30. import csv
  31. import matplotlib.pyplot as plt
  32.  
  33. def main():
  34.         tab = []
  35.         read_file('2cel.csv', tab)
  36.         plt.plot(tab[:])
  37.         plt.ylabel('some numbers');
  38.         plt.show()
  39.  
  40. def read_file(file_name, tab):
  41.         with open('2cel.csv', newline='') as csvfile:
  42.                 plik = csv.reader(csvfile, delimiter=',')
  43.                 for row in plik:
  44.                         tab.append(float(row))
  45. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement