This is the 16th video on Learn python in Malayalam. This video clearly explains below topics, use the below time link to skip to the specific topics Topics covered in this video Coin toss program - 00:23 calculating probability - 04:57 plotting absolute error plotting -- 07:53 Program used # Program for coin toss import random def coinToss(number): # defining the function for coin toss recordList= [] # multiple assignment for i in range(number): # do this 'number' amount of times flip = random.randint(0, 1) if (flip == 0): # here if condition is not neccessory # print("Heads") recordList.append(1) else: # print("Tails") recordList.append(0) print("Coin Toss result is :",str(recordList)) print("No of Heads :",recordList.count(1), "No of Tails :",recordList.count(0)) coinToss(10) # calling the function with 10 flips # program for calculating probability of coin toss import random import matplotlib.pyplot as plt N = 50 ab_errList = [] recordList= [] for i in range(N): # do this 'number' amount of times flip = random.randint(0, 1) if (flip == 0): # print("Heads") recordList.append(1) else: # print("Tails") recordList.append(0) # print("Coin Toss result is :",str(recordList)) print("Value of N is :",N) print("No of Heads :",recordList.count(1), "No of Tails :",recordList.count(0)) Prob_H = (recordList.count(1))/N Prob_T = (recordList.count(0))/N print("Probability of Head is :",Prob_H) print("Probability of Tail is :",Prob_T) ab_err = 0.5 - Prob_H print("Absolute error :",round(ab_err,3)) print("") ab_errList.append(round(ab_err,3)) # Program for plotting absolute error of coin toss import random import matplotlib.pyplot as plt N = [10, 100, 500,1000,5000,10000,50000] ab_errList = [] for j in N: recordList= [] for i in range(j): # do this 'number' amount of times flip = random.randint(0, 1) if (flip == 0): # print("Heads") recordList.append(1) else: # print("Tails") recordList.append(0) # print("Coin Toss result is :",str(recordList)) print("Value of N is :",j) print("No of Heads :",recordList.count(1), "No of Tails :",recordList.count(0)) Prob_H = (recordList.count(1))/j Prob_T = (recordList.count(0))/j print("Probability of Head is :",Prob_H) print("Probability of Tail is :",Prob_T) ab_err = 0.5 - Prob_H print("Absolute error :",round(ab_err,3)) print("") ab_errList.append(round(ab_err,3)) print(ab_errList) plt.plot(N,ab_errList) plt.title("N vs Absolute error") plt.xlabel("N") plt.ylabel("Absolute error") plt.show() For more details check out here : https://iammanuprasad.blogspot.com/ Learn Python in Malayalam Playlist: https://www.youtube.com/playlist?list=PLmKq-kgKY8uZya3cwcX6otT61NPHXbTK0 Chapter 1 - https://youtu.be/WiyQ8wTsRO0 Introduction to programming Introduction to Python Introduction to Google Co-lab How to setup Google Co-lab Chapter 2 - https://youtu.be/YFngtW42Mls Python Identifiers Lines and Indentation Multi-Line Statements Chapter 3 - https://youtu.be/gxalG8Aps0A Quotation in python Comments in python Assigning values to variable Chapter 4 - https://youtu.be/AaEL_f2RHIk Data types Numbers Strings Chapter 5 - https://youtu.be/irND35-6BZ0 Data types Lists Tuple Dictionary Chapter 6 - https://youtu.be/MRfg2QZBHvE Decision making Chapter 7 - https://youtu.be/VYXndepcTCM Loops in Python Chapter 8 - https://youtu.be/d7Y2D9H4u7c Functions in python Chapter 9 - https://youtu.be/hFOTKyYCkdw Classes in python Chapter 10 - https://youtu.be/w-_x2vfpJk0 Matrix in python Chapter 11 - https://youtu.be/-7DB7OEenms Plotting in Python Chapter 12 - https://youtu.be/aID_Dlx-oys File handling in python Chapter 13 - https://youtu.be/zk6Fcs-NY6I System linear equation solution Example with explanation Program for solving linear equation Chapter 14 - https://youtu.be/7k5oATBKrd8 differentiation in python power rule product rule multi-variable function first order differential equation response Chapter 15 - https://youtu.be/BoEPyohAvtI integration in python integration with double integral integration with triple integral integration with infinity limit If you like my video please subscribe my channel and share Important links & key words https://www.python.org/ Google COLAB Music: https://www.bensound.com Reff : https://www.tutorialspoint.com/python/python_variable_types.htm https://www.w3schools.com/ https://towardsdatascience.com/taking-derivatives-in-python-d6229ba72c64
Subscribe to:
Post Comments (Atom)
Signals & System Lect 15 | Stable & Unstable Systems | Solved examples
ECT 204 SIGNALS AND SYSTEMS Topics covered 00:00 - Introduction to Stable & unstable Systems 01:08 - BIBO criteria 03:38 Problem No 1...

-
AIM: To familiarise with logic gate IC packages and to verify the truth tables of those gates COMPONENTS AND EQUIPMENTS REQUIRED: IC...
-
Question) Show the design of a simple sofa and then depict how the design changes when considering 1) aesthetics and 2) ergonomics into co...
No comments:
Post a Comment