このケースでは、40人クラスで同じ誕生日の人が全くいない確率を求め、
最後に、全体の1から引き算する方式を取ります。
#same birthday in 40 member class
n=1.0
k=1.0
for i in range(40):
n=n*(365-i)/365.0
k=k-n
print(k)
What is sequence a particular order in which related events, movements, or things follow each other. a set of related events, movements, or things that follow each other in a particular order. what are 6 built-in types of sequence in python In this Python Sequence Tutorial, we will discuss 6 types of Sequence: String, list, tuples, Byte sequences, byte array, and range object. What are sequence types in Python? There are seven sequence types: strings, Unicode strings, lists, tuples, bytearrays, buffers, and xrange objects. Dictionaries and sets are containers for sequential data. See the official python documentation on sequences: What are the sequence data types? Sequences allow you to store multiple values in an organized and efficient fashion. There are several sequence types: strings, Unicode strings, lists, tuples, bytearrays, and range objects. Dictionaries and sets are containers for non-sequential data. Enable Ginger Cannot connect to Ginger Check your in...
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! The meaning of the 6th line is as follows. Sparse is better than dense. — In short, “don't try to stick too much code on one line.” [X] Although efficien...
コメント
コメントを投稿