Juego De Blackjack En Javascript

I'm very new to python and have been trying to make a multiplayer blackjack game on python for a while now. I've been running into lots and lots of problems and was wondering if you guys could help me with them.

This is what I have so far. I understand there are lots of gibberish and code that won't work. I was wondering if you guys can let me know what is wrong with the code and maybe suggest some options on how to fix it.

JuegoJuego blackjack javascript

En jQuery Love, que como su original nombre indica es un blog de amantes del jQuery y empiezan fuerte, ya que en su primer post nos presentan jQuery Blackjack, el famoso juego de cartas convertido en sentencias Javascript para que puedas jugar online y de paso, mostrar el potencial de Javascript. El objetivo del clasico juego de cartas Black Jack es tratar de completar 21, o una suma de cartas mayor a la que podria completar el que reparte las cartas, en este caso el computador! Click sobre Deal para empezar un nuevo juego. Click sobre Hit Me! Para pedir otra carta. Bonus valid for 14 days. 30 Spins on preselected games Juego De Blackjack En Javascript will be credited instantly + then 30 per day for 9 days. Free Spins valid for 72 hours from credit. Max Free Spins winnings £100. Skrill + Neteller Juego De Blackjack En Javascript excluded. Always refer to Bonus Terms. Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

My main concerns right now:

  1. I am making a 'multiplayer' blackjack game.I have no idea how I'm supposed to make a loop for a multiplayer blackjack game.In my code, I asked how many people are playing. How do I make a loop for the game without knowingwhat the number will be?

    Also, how do I create a function to find out the winner without knowing how many players are playing?

  2. After I type in

    The Players in the for loop gives me a syntax error. What is wrong?

As an update, I've thought about what you said about making a listand I still do not really understand how I should go aboutmaking a code to find out the winner.

Juego

Juego Blackjack Javascript

for example

even if I make a list, if i do not know how many players are actually playing, I wouldn't be able to compare the elements in the list. If I knew how many people were playing,

I can say

But since I won't know how many people are playing until the user actually types in the input, I am lost as to how I am supposed to write the code for the winner.

I do not know if there is a way of saying 'if this is bigger than the rest'. I only know how to say 'if this is bigger than that'.

Is there a way of saying 'if this is bigger than the rest' in python?If not, can you give me some suggestions to making the code to find out the winner?

In general, I think you did a good job overall. That is, getting the game logic to run without serious issue. There were a couple of errors that caused the game to not run correctly. One was if the player gets a blackjack the game exits without prompting the user for further action:

LOGIC

Juego De Blackjack En Javascript Gratis

I shortened the code up here but you can see since you do your check outside of 'hand-loop' and call break you will exit the program. This goes for if there is a push on blackjack too.

Exhausting the deck, where you only reset the deck if the player hits. This is because of how you are drawing cards by calling .pop.

If you keep standing on every turn you will eventually get an IndexError. You could just call random.choice on the deck and not have to worry about it while using some other condition to reset the deck:

STYLE

There are some style issues here too. These usually come down to personal preferences but if you are having others read your code its best to stay close to pep8 which is a general consesus for helpful style choices.

OOP

You also make use of global variables quite a bit. Usually using globals are considered bad practice. What you could do is think about where each one of these functions and variables would logically make sense to be grouped together. Then create a class to encapsulate the variables and functions, adhering to good OOP principles. You do this to a certain degree but you could further it by adding in the globals too:

CODE DUPLICATION

Juego De Blackjack En Javascript Compiler

Blackjack

You also have several spots of code duplication. Keeping with DRY (don't repeat yourself) you could use a loop or recursion to cut down on some of this:

Where you could pass in a list or any other kind of iterable and loop for them:

There are places where you are using counters too where iterating over the list itself or a range would be fine:

would be:

Juego De Blackjack En Javascript W3schools

Juego blackjack javascript

STANDARD LIBRARY

Juego De Blackjack En Javascript Play

One of the great things about Python is that there are a rich collection of libraries/modules already made by really intelligent people. Use this to your advantage and get to know different modules and what they offer:

becomes:

Where you can use itertools.product to create a cartesian product

I re-wrote your program by creating a different game-loop and making a couple of different classes: