write a function to accept a tuple and return the sum of elements ending with 3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

write a function to accept a tuple and return the sum of elements ending with 3

29th Apr 2021, 9:39 AM
Santhos raj
Santhos raj - avatar
6 Answers
+ 3
Hi! For better help to you, please, show us your code attempt! Thx!
29th Apr 2021, 9:41 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
If you want to run & share a code on Sololearn... Then, ➡️ Go to the Code Playground section (you can find it here : https://code.sololearn.com) and click on the + icon at the bottom right corner. ➡️ Then select language and write your code and save it. ➡️ Then click on Run and your Code will get executed. Then copy link code, and share it there OR just copy/paste this (your code solution from task)
29th Apr 2021, 10:00 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
How will you understand if a value is ended with 3? Well, if the reminder of the value of 10 is equal to 3 then the value is ended with 3.You can write like this: if l[i] %10== 3: Then it says you have to return the value.So you should return s in your code. So after editing your code it will be like this: https://code.sololearn.com/ca12A4a14A3A Note: For testing I have used this tuple (34,56,78,23,45,63)
29th Apr 2021, 11:11 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
29th Apr 2021, 1:04 PM
Santhos raj
Santhos raj - avatar
0
Ярослав Вернигора(Yaroslav Vernigora) I don't know how to share in this app
29th Apr 2021, 9:49 AM
Santhos raj
Santhos raj - avatar
29th Apr 2021, 10:06 AM
Santhos raj
Santhos raj - avatar