Тёмный

Beginner Python Tutorial - Mean Median and Mode 

PortEXE
Подписаться 21 тыс.
Просмотров 63 тыс.
50% 1

In this short lesson, we create a simple Python program that calculates the mean, median, and mode from a set of numbers.
#python3 #pythontutorial #learntocode
Installing Python: realpython.com/installing-pyt...
If you would like to support me on Patreon: / portexe
Follow me on social media! Links on my website: www.portexe.com/
Intro music by GhostxMachine
GAMING ➔ / portexe

Опубликовано:

 

6 июн 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 37   
@louierattatouie
@louierattatouie 2 года назад
Thank you so much for this tutorial! You are a great help! Definitely subscribing!
@almightysun7407
@almightysun7407 Год назад
Thanks this tutorial was so good and easy to understand! :)
@nikhilmehra1216
@nikhilmehra1216 4 года назад
thank you so much
@engineer_story6198
@engineer_story6198 2 года назад
Thanks for sharing video
@johnkiruba6236
@johnkiruba6236 4 года назад
How come the tuple values change once after declared? In a list of no recurring numbers how does the func returns the least value in the list? I mean where does the sort happen? Please Explain! thank you.
@noufalsuhaim2728
@noufalsuhaim2728 3 года назад
what if i want to enter the size of the list and then enter my list and calculate it ?
@UnpopularGameGuy
@UnpopularGameGuy 2 года назад
For mean, another clean way to do this, without using a for loop would be: def mean(nums): return sum(nums) / len(sums) print(mean([2, 5, 9, 8, 6, 2, 5, 4])) # this will print the mean of this list of numbers. We defined a function called mean, and have a parameter of "nums" that will pass through it. We then used the return function to take the sum(nums) and divide them by the length(nums). Finally, we called the mean function with a random list of numbers! Should equal 5.25, or if you wanted only integers and no float (decimal numbers), you could add a second divide symbol .... return sum(nums) // len(sums) = 5
@parasthakur9842
@parasthakur9842 Год назад
it showing type error
@AnilGupta-xc8pt
@AnilGupta-xc8pt Месяц назад
Here sums is not defined 😅😅
@srimanikanta3472
@srimanikanta3472 2 года назад
what we do, when we have execute more no of modes in a given list. how can we run
@venkannababu1986
@venkannababu1986 2 года назад
Here is the code for multiple modes in the list. def find_mode(list_n): #let convert list into sets so no duplicates new_set = set(list_n) new_list = list(new_set) counts = [] for i in range(len(new_list)): counts += [list_n.count(new_list[i])] max_count = max(counts) index = counts.index(max_count) print(new_list[index],end=" ") for i in range(index+1,len(counts)): if(max_count == counts[i]): print(new_list[i],end=" ") # Taking the input as integers using the map function list_n = list(map(int,input().split())) #calling function find_mode(list_n)
@guttamuneendra12339
@guttamuneendra12339 2 года назад
How to print two modes in single line ( if Two modes in list)
@peddannaganjayela6779
@peddannaganjayela6779 3 года назад
If mode > 1 then it is not working
@shobriarnanta1032
@shobriarnanta1032 3 года назад
why the total = 0 in mean?
@borykalderassoumou1778
@borykalderassoumou1778 2 года назад
This mode coding is only for an unimodal distribution. How about a multimodal i.e bimodal?
@bilalwarsi33
@bilalwarsi33 4 года назад
what's that ' != 0 ' in the median part? I tried it out and it said invalid syntax, i need help, thanks.
@PortEXE
@PortEXE 4 года назад
It means not equal. It’s likely something else that’s causing the error.
@bilalwarsi33
@bilalwarsi33 4 года назад
PortEXE thanks!
@bikramchettri9405
@bikramchettri9405 5 лет назад
Hey how can we add input field dynamically ?
@PortEXE
@PortEXE 5 лет назад
You can use the input function! So if you were to say: user_string = input("Please enter a string: "), it would set whatever the user typed equal to the user_string variable.
@bikramchettri9405
@bikramchettri9405 5 лет назад
@@PortEXE I'm talking about adding a dynamic input field to a form using add more field. Something like this oneway.cab/outstation.php
@vazhaabdu4529
@vazhaabdu4529 4 года назад
Nice video,however,the code you wrote for fining mode will only work finding one mode.and in most cases there are multiple modes in lists.also if your list has same amount of different numbers(for example [2,2,3,3]) then it will still say that mode is 2 in this case when there is no mode.
@NOBODY-ye3px
@NOBODY-ye3px 4 года назад
could you pls write the code for the same , pls
@venkannababu1986
@venkannababu1986 2 года назад
here is the code for the multiple modes in the list. def find_mode(list_n): #let convert list into sets so no duplicates new_set = set(list_n) new_list = list(new_set) counts = [] for i in range(len(new_list)): counts += [list_n.count(new_list[i])] max_count = max(counts) index = counts.index(max_count) print(new_list[index],end=" ") for i in range(index+1,len(counts)): if(max_count == counts[i]): print(new_list[i],end=" ") # Taking the input as integers using the map function list_n = list(map(int,input().split())) #calling function find_mode(list_n)
@rinkirout2329
@rinkirout2329 2 года назад
Not defined mean in median
@renee3901
@renee3901 Год назад
IDK why you didn't show how to find median if we have 5 numbers / if there was one number in middle
@easydatascience2508
@easydatascience2508 Год назад
see mine too. Most of the Python tutorials in the playlist. And R beginning course too.
@ladislousfarawadya5115
@ladislousfarawadya5115 3 года назад
the program only shows one mode even if there are two, anyways thanks a lot
@paulmcgreevy4173
@paulmcgreevy4173 Год назад
can you show this while not using a cut and paste from another site? where would the numbers we want a mean, median and mode from be actually typed into the code and how?
@yohomietony3945
@yohomietony3945 4 года назад
When I try the mode, the answer is always the first number in the list. Ex. (3,4,5,5,6) the mode should be 5 but it outputs 3. Could you see if it does the same thing for yours?
@yasaswinidesu2225
@yasaswinidesu2225 4 года назад
Keep the return statement at the end of the for loop. I guess you kept at the end of if statement
@aqua6150
@aqua6150 4 года назад
@@yasaswinidesu2225 CAn you send the code to calculate mode please..
@aqua6150
@aqua6150 4 года назад
​@@yasaswinidesu2225 hey I am from cse-D
@majorgeneral2812
@majorgeneral2812 Год назад
You said simple? .......head explodes in shear stupidity.
@elieledouxjobin163
@elieledouxjobin163 3 года назад
it is no working
@elieledouxjobin163
@elieledouxjobin163 3 года назад
yes
@elieledouxjobin163
@elieledouxjobin163 3 года назад
^
Далее
Python for Beginners - Learn Python in 1 Hour
1:00:06
Просмотров 17 млн
Math Antics - Mean, Median and Mode
11:04
Просмотров 6 млн
БАТЯ И СОСЕД😂#shorts
00:59
Просмотров 2,1 млн
🤡Украли У ВСЕХ🤪
00:37
Просмотров 247 тыс.
Statistics Fundamentals in Python
25:35
Просмотров 32 тыс.
Python NumPy Tutorial for Beginners
58:10
Просмотров 1,5 млн
How To Use Functions In Python (Python Tutorial #3)
14:55
Learn Python With This ONE Project!
55:04
Просмотров 1,7 млн
Solving real world data science tasks with Python Pandas!
1:26:07