Skip to content
Sign upLog in
← Back to Community
Not Sure Why This isn't working?
Profile icon
1Dagree

Its not completed but it just keeps repeating same thing and i did not program it to do that can someone help

Voters
Profile icon
BenjaminNamikas
Profile icon
Coder100
Profile icon
noodles37
Profile icon
8D_Joe_Efretuei
Profile icon
1Dagree
Comments
hotnewtop
Profile icon
8D_Joe_Efretuei

Do you have a YouTube Channel called Uzalii with 143 subs

Profile icon
1Dagree

Yes, why

Profile icon
8D_Joe_Efretuei

@Uzalii
I subbed you got some good content

Profile icon
1Dagree

@8D_Joe_Efretuei Thx

Profile icon
8D_Joe_Efretuei

Idk why bro

Profile icon
8D_Joe_Efretuei

Your working on Mafia nice

Profile icon
kjellkristensen

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

amazing i just get free 10K subscribers from here: https://beacons.ai/youtubesubscribers

Profile icon
BenjaminNamikas

lol. the problem is that you put all the code for people guessing and for you to guess in the else statement, so it skips it if you are the mafia and the loop repeats and prints you are the mafia.

Please upvote or mark that this is the answer if it has helped/ given you the answer

Profile icon
1Dagree

@BenjaminNamikas
Its going to have some different code to the what's in the else statement

Profile icon
BenjaminNamikas

@Uzalii
oh then what is the problem

Profile icon
1Dagree

@BenjaminNamikas
I don't seem to die even if every1 votes for suspect 4 (which is you) when I am not the mafia

Profile icon
BenjaminNamika1

@Uzalii
That is because you check if anyone thinks if it is you then you get one, even if there are multiply, so if they all think it is you you get one point, and if you suspect anyone else then they will get one point and you won't die because you are not greater that everybody else

Profile icon
conspicous
Profile icon
noodles37

@Uzalii
I would like to help but can you explain how its meant to work? And also what the variables are. What do you mean it repeats the same thing? You made it do that with the while loop.
Also if you are the mafia, it prints infinitely, is this meant to happen?

Profile icon
1Dagree

@SilentShadowBla
the code isn't fully completed yet but the problem is that if you are the most voted (4) then dead should equal true and the game ends but that doesn't happen even if 4 is the most voted (the variable you) it just asks you who the mafia is again. Instead of saying you died and the mafia wins that is the problem.

Profile icon
noodles37

It is going to keep asking you who the mafia is until dead = true

@Uzalii

I am still a bit confused... lol

Profile icon
1Dagree

If you look at the if statment closer to the bottom it says that if you are the most votes then print mafia win and there is the variable dead there which now says dead=True but this if statement is completely ignored even if you (4) are the most voted it still ask you who do you think the mafia is

@SilentShadowBla

Profile icon
noodles37

Tell me if I'm wrong: You only want one input from the user and one from each bot and then it calculates if you have the most votes...? Btw, when it is counting up the votes the number is never over one. lets say that 3 people voted for 3, the value is still 1 vote it would be gr8 if u shared the repl with me...
another thing, you cant vote 4 urself is this supposed to happen

@Uzalii

Profile icon
1Dagree

Yh u are are suppose to be able to vote for itself and 1 person should count as 1 vote so 1 person votes for 3 that counts as 1 vote for three.

@SilentShadowBla

Profile icon
noodles37

are you able to share it with me or are u doing a solo project?

@Uzalii

Profile icon
1Dagree

Right now I am on phone I will send the repl to u when I get on PC

@SilentShadowBla

Profile icon
noodles37
Profile icon
1Dagree
Profile icon
AllAwesome497

It wont stop looping until dead is False, so at some point you have to make dead equal True otherwise it will loop forever.

Profile icon
noodles37
Profile icon
1Dagree

@AllAwesome497
i do that when you are the most voted it should print the mafia wins and dead = True however it just continues asking you who you think the mafia is no matter how many people vote for you (4) everything else is fine

Profile icon
JonathanBrazier

it repeats until you die and if your card == 4 it prints 'you are the mafia' to stop it you would have to change the card number or otherwise it will print the same thing forever

Profile icon
1Dagree

@JonathanBrazier
that part is fine that is what is meant to happen (it's not completed yet) my issue is that when you (4) are the most votes to be killed it just continues askin you who the mafia is even though there is an i statement that say if you are the most votes then dead = True

Profile icon
[deleted]

what does it keep repeating? please provide more context. it looks like it runs fine to me...

Profile icon
LizFoster

@sugarfi
he means that, no matter what you enter, it'll only ever say
"You are a civillian
Your number is 4
Who do you think the mafia is (1-4):"

Profile icon
[deleted]

@LizFoster
that is just the random function though - if you choose a number 1-4, 1, 2, and 3 are much more likely, and come up almost all the time. The reason it always prints Your number is 4 is because he wrote print("Your number is 4"). It repeats because it is in a while loop. There is nothing going wrong there...

Profile icon
LizFoster

@sugarfi
Yes, exactly. I am not saying that the code does something it's not made to do, I was simply clarifying what he was asking for.

Profile icon
1Dagree

@sugarfi
the code isn't fully completed yet but the problem is that if you are the most voted (4) then dead should equal true and the game ends but that doesn't happen even if 4 is the most voted (the variable you) it just asks you who the mafia is again. Instead of saying you died and the mafia wins that is the problem.

Profile icon
[deleted]

@Uzalii
i did get voted though, and i died...

Profile icon
1Dagree

@sugarfi
i tried it and i am still not getting killed. How did you manage to die?

Profile icon
[deleted]

@Uzalii
again, the random module. It is just not very likely to die.