Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
731 B
3
Indexable
Never
import scipy.stats as stats

def get_data_from_user():
    try:
        data_str = input("Enter your data separated by spaces: ")
        data = list(map(float, data_str.split()))
        return data
    except ValueError:
        print("Invalid input. Please enter numeric values separated by spaces.")
        return get_data_from_user()

def calculate_skewness(data):
    skewness = stats.skew(data)
    return skewness

def main():
    print("Welcome to the Skewness Calculator for Ungrouped Data!")
    
    # Get data from the user
    data = get_data_from_user()

    # Calculate and print skewness
    skewness_result = calculate_skewness(data)
    print("Skewness:", skewness_result)

if __name__ == "__main__":
    main()
Leave a Comment