sentence="Sheena eating mango and apple. Her sister also loves eating apple and mango" sentences=sentence.split() print(sentences) for word in sentences: counts=sentence.count(word) print(f"Number of times ${word} appears:", counts)
@shobhit618321 күн бұрын
Or You can use below also def common_letters(): set1 = set(input("Enter your first string :- ")) set2 = set(input("Enter your second string :- ")) common = set1.intersection(set2) return list(common) common_letters()
def count_words(): str1 = input('Enter the string') list_=str1.split() dic_={} for i in list_: if i in dic_: dic_[i]= dic_[i]+1 else: dic_[i]=1 print(dic_) count_words()
@gxldybubbleАй бұрын
Guys I might be cooked
@AdityaGupta-yx7trАй бұрын
nice explanation especially where u showed the pattern 5:00
@MALAYALIKKARANАй бұрын
Watching this video for tomorrows(12.10.24)interview at cochin for python developer
@somasundaram2809Ай бұрын
Whether you are selected or not
@AravTristyАй бұрын
at 6.43 what is x:x(i) ?
@debojitmandal8670Ай бұрын
A = [40,50,60,80] B = [100,50,20,10] a=set(A) b=set(B) a.intersection(b)
@pujarameet9699Ай бұрын
I m pasting my external ip but the webpage is not loading
@MrigankGupta-m5zАй бұрын
matching_bracket = {')': '(', ']': '[', '}': '{'} stack = [] for char in expression: if char in matching_bracket.values(): stack.append(char) elif char in matching_bracket: if not stack or stack.pop() != matching_bracket[char]: return False return not stack
@debojitmandal8670Ай бұрын
d={} for i in s: if i in d: d[i]=d[i]+1 else: d[i]=1 m=[ ] for k,v in d.items(): if v==1: m.append(k)
@dineshmishra6502Ай бұрын
good
@debojitmandal8670Ай бұрын
def max_sum(arr): curr_value = 0 max_value = arr[0] for i in range(len(arr)): curr_value += arr[i] # Always update max_value to track the highest sum so far max_value = max(max_value, curr_value) # Reset curr_value if it goes negative if curr_value < 0: curr_value = 0 return max_value
@KofiSaptonn2 ай бұрын
Could you please recommend any free online course to help me improve in my programming skills?
@debojitmandal86702 ай бұрын
a=[1,1,2,2,3,3,4,4,5,5,6,6] b=[] for i in a: if i not in b: b.append(i) b
@245anilkumar92 ай бұрын
word=input("enter the input:").upper() word2=input("enter the second word:").upper() for i in set(word): if i in set(word2): print(i)
@rhugvedsatardekar92292 ай бұрын
l = [1,2,4,5,6] for i in range(1,len(l)): if l[i]-1 not in l: print(f'{l[i]-1} is missing')
@debojitmandal86702 ай бұрын
now with inbuilt functions from itertools import combinations b=combinations(list,2) a=[ ] for i in b: print(i) z=abs(i[0]-i[1]) print(z) a.append(z)
@DHAMODHARANK152 ай бұрын
I got error that error is Node() takes no arguments... how to solve this err
@debojitmandal86702 ай бұрын
my approach is su=17 from itertools import combinations x=combinations(arr,2) l=[ ] for i in x: s=i[0]+i[1] if s ==su: l.append(s)
@touheedfathima89232 ай бұрын
def subarray_sum(arr,sum): dict1={} curr_sum=0 for i in range(len(arr)): curr_sum=curr_sum+arr[i] if curr_sum == sum: print("Subarray starts from 0 to ",i) return if curr_sum-sum in dict1: print("subarray starts from ",dict1[curr_sum-sum]+1,"to",i) return dict1[curr_sum]=i print("no subarray found") arr=[1,4,20,3,10,5] sum=33 subarray_sum(arr,sum)
@debojitmandal86702 ай бұрын
this method is incorrect bcs its ok for one missing value but if u have multiple missing values this will not work for eg l=[1,2,4,5,6,7,9,10,11,12,15,16] the total mssing numbers is 38 but the missing values are 3,8,13,14 @SrikanthDuvvala-iz5tv method is perfect
@Rohitchauhan-kg7sp2 ай бұрын
Nice Explanation, Thank You!
@debojitmandal86702 ай бұрын
my question i we can use Counter from collections and do it so y r u complicating it
@nETSETOStECH2 ай бұрын
If the interviewer asks not to use any inbuilt library, then to use this
@devmrnecro42152 ай бұрын
I did it like d={} L1=[<value>] L2=[<value>] for i in range(0, len(L1): d[L1[i]] = L2[i] print(d) simple
@nETSETOStECH2 ай бұрын
👍
@sandeepthukral30182 ай бұрын
initialize d
@devmrnecro42152 ай бұрын
@@sandeepthukral3018 common sense lagao bhai d lagana bhul gaya logic p dhyan do bas
@devmrnecro42152 ай бұрын
Dont make it this complicated just male a function def words(): s=input(“enter the string: ) w=s.split() d={} for i in w: if i not in d: d[i]=1 else: d[i]+=1 Simple to do
@henryeffiom76102 ай бұрын
But I want to deploy my project already built with vscode and phpmyadmin how can I go about it?
@freaky111002 ай бұрын
samaj nhi aaya
@kjoeysspena28452 ай бұрын
string_1 = "CJAMENOOO" string_2 = "Helloooo" def matching_letters_in_two_strings(string1, string2): matching_strings = [i for i in string1.lower() if i in string2.lower()] return(set(matching_strings))
Another solution could be -- A=[5,7,4,3,9,8,19,21] target=12 dict1={} A.sort() for x in range(len(A)): for y in range(x+1,len(A)): if A[x]+A[y]==target: dict1[A[y]]=A[x] print(dict1)
@Basavaraj.Y.S2 ай бұрын
Please check this out, its more simple solution ip_list = [5,7,4,3,9,8,19,21] sum_value = 17 for i in ip_list: print(i) extra = sum_value - i if extra in ip_list: first_val = ip_list.index(i) second_val = ip_list.index(extra) print(first_val,second_val)