Skip to content
Snippets Groups Projects
ex2_1_1.py 437 B
Newer Older
  • Learn to ignore specific revisions
  • bjje's avatar
    bjje committed
    import numpy as np
    
    
    x = np.array([-0.68, -2.11, 2.39, 0.26, 1.46, 1.33, 1.03, -0.41, -0.33, 0.47])
    
    bjje's avatar
    bjje committed
    
    
    # Compute values
    mean_x = x.mean()
    
    bjje's avatar
    bjje committed
    std_x = x.std(ddof=1) # ddof: Delta Degrees of freedom
    
    median_x = np.median(x)
    range_x = x.max() - x.min()
    
    bjje's avatar
    bjje committed
    
    
    # Display results
    print("Vector:", x)
    print("Mean:", mean_x)
    print("Standard Deviation:", std_x)
    print("Median:", median_x)
    print("Range:", range_x)
    
    bjje's avatar
    bjje committed
    
    
    bjje's avatar
    bjje committed
    print("Ran Exercise 2.1.1")