Does this work? l = [] for i in range(60): l.append(random.randint(1,365)) l.sort() for i in range(len(l)-1): if(l[i] == l[i+1]): print('repeats', l[i], l[i+1])
Respected Sir, I have done the home work. Kindly can you please validate. l=[1,1,5,5,6] #create empty list #for i in range(30): #l.append(random.randint(1,365)) #append random numbers from 1 to 365 #append 30 of them l.sort() print(l) i=0 count=0 while(i
from random import randint date_collection=[] for i in range(30): date_collection.append(randint(1,365)) print(f"The various 30 random date between are {date_collection}") data_collection=date_collection.sort(reverse=True) print(f"The decending order random date between are {date_collection}") no_repeat_condition=True for i in range(0,len(date_collection)-1): if(date_collection[i]==date_collection[i+1]): no_repeat_condition=False print(f"we found repeating values {date_collection[i]} and {date_collection[i+1]}") if(no_repeat_condition): print(f"we didnt find any repeating values")
Sir your energy removes my lazyness😁thanks for this awesome lecture
The clicks of keyboard is relaxing 😌
Ur way of telling is nice, more interesting 🎉🎉BINGOOO
10:50 Listen to Sudarshan Sir's evil laugh😂😂. Play it at different speeds at 0.5, normal or 1.75, hard to determine where it sounds more evil. 😂😂😂
awesome it was sir , till date I enjoyed this lecture most and not regretting to be the part of this learning .
random.random(): 2:22
random.randint(): 3:44
birthday paradox: 4:49 5:08 5:30 5:43 8:25 9:12 9:47 10:25 11:00 12:30 13:00 13:43 16:45 18:56
l.sort: 7:22
repetition: 7:27 7:46 (proof)
simulation: 18:56 19:39 20:31 21:00
why are you wasting your time bro.
@@nikhilatiitm I will try not to :)
Since we know the length of the list, a for loop is a better option isn't it?
Absolutely. 👍
Does this work?
l = []
for i in range(60):
l.append(random.randint(1,365))
l.sort()
for i in range(len(l)-1):
if(l[i] == l[i+1]):
print('repeats', l[i], l[i+1])
sir ,you just have to remove break or else use continue instead , inorder to get get an output of one or more repeatations, right?
Sir should use 1,366 in randrange so as to include 365 i.e. to add Dec 31,right?
To get all the repeating no. in a list, we just need to remove "break" from the if-block..
also the break keyword
how to know when to use different brackets like (), {}, and []
just learn or memorise it
Respected Sir,
I have done the home work. Kindly can you please validate.
l=[1,1,5,5,6]
#create empty list
#for i in range(30):
#l.append(random.randint(1,365))
#append random numbers from 1 to 365
#append 30 of them
l.sort()
print(l)
i=0
count=0
while(i
I like your style
Remove 'break' and get the all repeating elements printing in kernal
use of flag??
Surprised to see why code did not error out for len(l-1), It has to be len(l-2)....any reason why code worked on your machine professor?
because there is no equality at len(i-1), rewatch at 15:50
@@ZampGaming Thanks.... missed it... actually '
@@manishpatankar7020 then subscribe me 😂
Minor slippages. Please adjust 😄
@@sudarshaniyengar1814 Thank you sir...
18:31 just simply remove break to get all repetition
Which video were we taught about import math?
exactly my doubt too
23rd video of the list - "import library"
do we really need to use flag here?
yep
105 105 to hai hi, hindi bhi hai hi.
from random import randint
date_collection=[]
for i in range(30):
date_collection.append(randint(1,365))
print(f"The various 30 random date between are
{date_collection}")
data_collection=date_collection.sort(reverse=True)
print(f"The decending order random date between are
{date_collection}")
no_repeat_condition=True
for i in range(0,len(date_collection)-1):
if(date_collection[i]==date_collection[i+1]):
no_repeat_condition=False
print(f"we found repeating values {date_collection[i]} and {date_collection[i+1]}")
if(no_repeat_condition):
print(f"we didnt find any repeating values")
For people using PyCharm as their IDE, add a " ; " at the end of the break statement.
थैंक्यू
Great
At 23:20 sir spoke in hindi mistakenly😂😂😂
Sir used a little bit of Hindi here😅
i heard that "105 to h hi" 😂
@@harshitchhipa yeah