We can use just use 3 series of code lines to perform outstanding calculations in Python finding an average figure or value.
To find an average of a list of numbers in Python, every user is supposed to have an idea of using the built-in command such as the sum command and the len function or syntax.
Given the below details:
1,2,3,4,5,
Find the average of the above-given numbers.
Approach
To find the average:
1. Input the editor in line1 with the below command: Numbers = [1,2,3,4,5] 2. In line2 of the opened editor, ensure to enter the following command: Average = sum(numbers) / len(numbers) 3. In line3, feed the system with the below command: Print(average)![]()
The aforementioned three/3 lines compute the total sum of the numbers given from 1,2,3,4,5 and divide it by the number of numbers available, that is 5.
In the CODE EDITOR perform the following after the numbers are fed:
1. Click on the three/3 dots at the top right corner of the editor(those using a phone) 2. Move to the Execute button 3. Select and tap on the command execute or run 4. Select the language, that is Python from the given list 5. Make sure you select the compiler as required 6. Finally, click or tap on the run command to execute the command to the console.
About Author
Discover more from SURFCLOUD TECHNOLOGY
Subscribe to get the latest posts sent to your email.