can any one explain this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
16th Aug 2020, 5:54 AM
sravani
sravani - avatar
7 Answers
+ 4
t = (1,2,5,4,5) r = (3,5,6,4,4) z = r + t print(z) it will give output as z=(3,5,6,4,4,1,2,5,4,5) c=z.count(t[3]) t[3]= 4 and if u count then its repeat 3 times so 3 will be answer
17th Aug 2020, 4:11 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
t=(1,2,5,4,5) r=(3,5,6,4,4) z=r+t c=z.count(t[4]) print (c) z = r + t which makes z = (1,2,5,4,5,3,5,6,4,4) and the count method returns the number of times the integer *5* appeared in z since 5 is index four and it appeared 3 times
17th Aug 2020, 10:13 PM
Fox
Fox - avatar
+ 3
sravani z = addition of r and t z = (3,5,6,4,4,1,2,5,4,5) Now, c = z.count(t[3]) c = z.count(4) What z.count(4) means is count how many 4's are in z.🙂 Therefore, c = 3. Happy Coding 😀😀
16th Aug 2020, 6:06 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 2
t = (1,2,5,4,5) r = (3,5,6,4,4) z = r + t print(z) # print <z> so you know what it's like c = z.count(t[3]) # t[3] is 4, so <c> is count of 4 in <z> print(c) (Edited)
16th Aug 2020, 5:59 AM
Ipang
+ 1
No, t[3] is 4, and t[4] is 5.
16th Aug 2020, 6:05 AM
Ipang
0
i get t[4] is 3 how it is possible
16th Aug 2020, 6:03 AM
sravani
sravani - avatar
0
tq😊
16th Aug 2020, 6:14 AM
sravani
sravani - avatar