7 ответов
+ 2
Question section is for your doubts you found in your code not for assignment.
Try yourself then ask where you got stucked.
+ 2
Rudresh you didn't provide the code... Without that you won't get an answer.
+ 2
Thanks Abhay
+ 1
You can use a dictionary data structure to store how many times a character occur and then print out those characters whose occurence is more than 1
Do it like this ,
Take a variable count initialized to 0,
Iterate over the tuple then check if item in tuple is in dictionary ,if yes increment the count by 1 and assign it as value to it's respective key(item)=>dict[item]=count
finally iterate over the dictionary items and check value is greater than 1 if yes print out its respective key
Edit:from "if yes" I meant if item is not in dictionary insert the item in dictionary by incrementing count value by 1 ,if item is in dictionary then take the previous count value of it and increment it by one ,let me know if get stuck anywhere
+ 1
this is the code to get repeating items and non repeating items:
https://code.sololearn.com/cd9R3KfnEh9p/?ref=app
0
it's not an assignment I was doing practice and I got stuck myself in this program.
I try but I can't do it
0
here it is
mytup=("a","b","a","c")
for i in mytup:
for j in mytup:
if i==j:
print(j,"is repeated")
else:
print("Not repeated")