+ 2

If I have 2 players and each get points. Ho would write a line of code to say, if playerA number is = b then don't add a point?

I have (blist[I] = alist [I] { Something}

3rd Sep 2019, 9:42 PM
Sunflowermoon
12 Respuestas
+ 3
Ok buddy. This should be close to what you want. You can tweak it to suit your final shape & pretty up the output. Its a very simple code using list slices, which will be covered in your python course. Read up to understand how it works https://code.sololearn.com/cyk0dmHIbpmM/?ref=app
5th Sep 2019, 12:44 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 6
texas1234 you don't even need an else case here as nothing needs to be done when the corresponding entries are equal.
4th Sep 2019, 3:24 AM
Sonic
Sonic - avatar
+ 4
In your pseudocode, you're using arrays. What are they arrays of?
3rd Sep 2019, 11:21 PM
Sonic
Sonic - avatar
+ 3
If you want both parties to get a point if scores are even, Then If A ==B: aparty +=1 bparty +=1 This will assign a point each for a draw
4th Sep 2019, 7:07 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Please message me with your code attached as I don't understand what you are trying to achieve. I will review when I next get a chance & see if I can help you resolve this.
4th Sep 2019, 10:24 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Thank you!
5th Sep 2019, 2:33 AM
Sunflowermoon
+ 2
int a = 10; int b = 10; if(a > b || b > a ){System.out.print(true);} else{System.out.print(false);} //output false This would mean if a == b false b == a false a > b true get points b > a true get points a < b true get points b < a true get points
3rd Sep 2019, 10:27 PM
D_Stark
D_Stark - avatar
+ 2
UPDATE My code: ( NUMBERS BEING COMPARED) alist [] = { 3, 6,10}; blist [] = { 5,6, 7} ; Int aScore=0; Int bscore=0; For ( int I=0; I <alist.length; I++) { If (alist [ I ] > blist [ I] ) { aScore++; } else if ( blist [ I] > alist [ I ] ) { bScore++; } Else ( blist is equal to alist neither get a point ( HOW DO I CODE THIS PART) THE OUTPUT NEEDS TO BE 1 1 ( 1 POINT FOR EACH LIST THE EVEN SCORE NOONE GETS A POINT) THANKS!
3rd Sep 2019, 11:53 PM
Sunflowermoon
+ 2
4th Sep 2019, 1:59 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Sonic is right. If you don't refer to the inputs being equal, then the code will not create an output regarding that status.
4th Sep 2019, 6:41 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Ok so see but also I need the output to be 1 1. I'm currently getting 1 0 1 0 1 1
4th Sep 2019, 2:39 PM
Sunflowermoon
+ 1
The output is 1 0 10 1 1 I want just 1 1 it's not comparing it the way I want
4th Sep 2019, 10:11 PM
Sunflowermoon