Today python challenge:
Question :write a program to find the first repeated word in the given string.
Sample 1: string = "aabcdddd"
Output :a
Sample 2: string = "babadd"
Output: b
Sample 3: string = "success"
Output: c
Question :write a program to find the first repeated word in the given string.
Sample 1: string = "aabcdddd"
Output :a
Sample 2: string = "babadd"
Output: b
Sample 3: string = "success"
Output: c
Python Forever
Today python challenge: Question :write a program to find the first repeated word in the given string. Sample 1: string = "aabcdddd" Output :a Sample 2: string = "babadd" Output: b Sample 3: string = "success" Output: c
def repeat_cha(string):
set1 = {}
for letter in string:
if letter in set1:
return letter
else:
set1[letter] = 0
print(repeat_cha("successful"))
set1 = {}
for letter in string:
if letter in set1:
return letter
else:
set1[letter] = 0
print(repeat_cha("successful"))
Find second largest number in the given list??
Sample = s
S1 = [2,5, 6,3,4,8,9,8,9]
O/p = 8
S2=[6, 5,1,7,8,3,8,7,6]
O/p = 7
Sample = s
S1 = [2,5, 6,3,4,8,9,8,9]
O/p = 8
S2=[6, 5,1,7,8,3,8,7,6]
O/p = 7
3. Solve this problem
Sample input 1: "a1b2c3"
Output : abbccc
Sample input 2: "x2y4z6"
Output : xxyyyyzzzzzz
Sample input 1: "a1b2c3"
Output : abbccc
Sample input 2: "x2y4z6"
Output : xxyyyyzzzzzz