Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:59:50+00:00 2026-06-12T02:59:50+00:00

client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((HOST,PORT)) screen_width = 0 screen_height = 0 while True: client_socket.send(loc\n)

  • 0
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect((HOST,PORT))

    screen_width = 0
    screen_height = 0

    while True:
        client_socket.send("loc\n")
        data = client_socket.recv(8192)
        pos_coordinates = data.split()

        if(not(pos_coordinates[-1] == "eom" and pos_coordinates[0] == "start")):
            continue

        if (screenw != int(pos_coordinates[2])):
            screenw = int(pos_coordinates[2])
            screenh = int(pos_coordinates[3])

        blalba(pos_coordinates)

How can i get the average of 3 pos_coordinates list values ?
For example if pos_coordinates[8] contains the value 345, i want to get the average of that value and use the averaged value. the reason i want to do this, is because i am getting noise from the image detected through the camera and i thought the best way to go about this is to get the average of the values in order to get the value that i want. Any examples on how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:59:51+00:00Added an answer on June 12, 2026 at 2:59 am

    For getting the average of the whole list;

    average = float(sum(pos_coordinates))/len(pos_coordinates)
    

    If you just want to get the average of a subset, use a slice;

    subset = pos_coordinates[3:9]
    average = float(sum(subset))/len(subset)
    

    In python 3.x the explicit float conversion is not necessary anymore to get accurate division.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to connect to a server (e.g. smpp server) and send periodic data
If you create a TCP client socket with port 0 instead of a non-zero
I'm binding a client TCP socket to a specific local port. To handle the
Simple scenario: Client connects to server with socket.io ( socket = io.connect(...) ) Server
I am writing an app, where a socket is connecting to a host and
I'm running out of file descriptors when my program can't connect another host. The
i have to create connecting server<=>client. I use this code: Server: import socket HOST
I'm try to send and get data using sockets between Adobe flash client and
Is it possible to check if the client socket is keeping connection alive at
I'm trying to write a server-client socket program in C. The objective is for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.