If we are counting occurrence of a num in let say A and B and C. How can we count how many times do ABC occur at the same time. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

If we are counting occurrence of a num in let say A and B and C. How can we count how many times do ABC occur at the same time.

26th Jul 2020, 11:27 AM
Agazi Birhanu
Agazi Birhanu - avatar
9 Antworten
+ 3
Once the formatting is fixed, your code is almost correct. You just need to find the smallest number out of T, C and G and multiply this by 7. Then add this to the sum of squares.
26th Jul 2020, 1:00 PM
benjamin
+ 7
Agazi Birhanu , please rework your question, and also present us data samples for input and output. Regardless to this, you are asked to show us your attempt in coding this task. Please put your code in playground and link it here. Thanks!
26th Jul 2020, 12:36 PM
Lothar
Lothar - avatar
+ 4
You didn't showed an example of what you mean neither mentioned occurence of num in what as Ipang already mentioned
26th Jul 2020, 12:06 PM
Abhay
Abhay - avatar
+ 4
Did it thanks benj i i understood what u mention it works. https://code.sololearn.com/caChirJru2ZI/?ref=app
26th Jul 2020, 1:05 PM
Agazi Birhanu
Agazi Birhanu - avatar
+ 3
Occurence of number in what? can you show an example; Add language specification in thread tags please;
26th Jul 2020, 11:35 AM
Ipang
+ 3
Seven Wonders is a card drafting game in which players build structures to earn points. The player who ends with the most points wins. One winning strategy is to focus on building scientific structures. There are three types of scientific structure cards: Tablet (‘T’), Compass (‘C’), and Gear (‘G’). For each type of cards, a player earns a number of points that is equal to the squared number of that type of cards played. Additionally, for each set of three different scientific cards, a player scores 7 points. For example, if a player plays 33 Tablet cards, 22 Compass cards and 11 Gear card, she gets 3**2+2**2+1**2+7=21 points. It might be tedious to calculate how many scientific points a player gets by the end of each game. Therefore, you are here to help write a program for the calculation to save everyone’s time. Its kattis problem.
26th Jul 2020, 12:52 PM
Agazi Birhanu
Agazi Birhanu - avatar
+ 2
I'm not sure what you're asking exactly, but from your sentence, "every time three of them occur", it seems like you want to use iteration. Also your indentations are wrong which is causing the error. you need to unindent the lines which are indented for no reason. Once that is sorted you need to be clearer with what is wrong. Give us a sample input string and say what output you expect compared to what output you get.
26th Jul 2020, 12:47 PM
benjamin
+ 2
Excellent! Well done.
26th Jul 2020, 1:05 PM
benjamin
0
Its python the if statement dont work any ideas i want to add 7 every time three of them occur https://code.sololearn.com/c2wKqa2c6L23/?ref=app
26th Jul 2020, 11:37 AM
Agazi Birhanu
Agazi Birhanu - avatar