Create a code for playing blackjack
The first part of the code will create two variable.
One for the first card you’re dealt and one for the second.
Add those two variable for the total score you have

Then
Create a while loop that will stop if your score becomes above 21 or if the user says that they wish to stay.
Inside the while loop have ask the user if they want to hit or stay. Inside of the question be sure to print the current total that the user has
If the user inputs “hit” add a random number between 1 and 11 to their score.
If they input “stay” then print their final score
Then
Create a code for the dealer
The dealer should also start with two cards (remember you can always copy and paste and then edit your code)
Create a while loop for the dealer. (there is rule that dealers must always hit if their total is 16 or under
Print the dealers score once they are done.

Finally
Check if your score is higher than the dealer’s.
If it is you win
If not, you lose

Remember.
If either the dealer or you reach over 21 then that person automatically loses

Answers

Answer 1

Answer:

import random

is_stay = 'n'

y_fcard = random.randint(1, 11)

y_scard = random.randint(1, 11)

d_fcard = random.randint(1, 11)

d_scard = random.randint(1, 11)

you_score = y_fcard + y_scard

dealer_s = d_fcard + d_scard

print("Your score", you_score)

print("dealer's score", dealer_s)

while is_stay == 'n':

   if you_score > 21:

       break

   you_score += random.randint(1, 11)

   print("Your score", you_score)

   is_stay = input("Do you want to stay y/n?: ")

   if you_score > 21:

       print("You lost")

       quit()

while dealer_s <= 16:

   dealer_s += random.randint(1, 11)

   if dealer_s > 21:

       print("The dealer lost")

       quit()

if you_score > dealer_s:

   print("You are the winner", "My score: ",you_score, "\nDealer's score: ", dealer_s)

else:

   print("Sorry, you lost the game", "My score: ",you_score, "\nDealer's score: ", dealer_s)

Explanation:

The python program uses the random module's 'randint' to get a random integer number between 1 and 11, and adds the value to the user's score if the user decides to hit but compares the result with the dealer's if the user stays.


Related Questions

what is bit and byte in computer​

Answers

A bit is the smallest unit of information a byte is to see how many bits need to be represented (letters/characters)

Hope this helps

sales management at ursa major solar wants to allow users create new account records with pre populated values.which feature should administrator

Answers

Question:  sales management at ursa major solar wants to allow users create new account records with pre populated values.which feature should administrator

Answer:  Sales representatives at Universal containers often schedule in

person meetings at customer offices. Management wants to track   activities for this meeting category to clearly display customer office meetings in the account , contact or opportunitity page  layouts, as well as adding this data to reports.

Explanation:

A CD and a DVD are both secondary storage devices, explain to a friend the difference between both​

Answers

Answer:

i dont have any friends to explain it to

Explanation:

In
the first computer ran a program from memory.
0 1942
1950
1948
1968

Answers

The first computer to run a program from memory was 1950.

Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it

Answers

Answer:

Here

Explanation:

To move keyboard to bottom of screen, you just need to tap and hold the keyboard icon at the bottom-right corner of the keyboard, choose Dock option. To fix iPad keyboard in middle of screen, please tap and hold the keyboard icon, then choose Dock.Nov 5, 2020

short note on first generation computer​

Answers

Answer:

The period of first generation was from 1946-1959. The computers of first generation used vacuum tubes as the basic components for memory and circuitry for CPU

PLEASE ASAP!!

Today, most film editors manually cut and splice the actual film footage once it arrives.


O True
O False

Answers

The correct answer should be true, as their job is to *edit* the footage.

Answer:

True

Explanation:

edg2021

The film editor is such an important person on a film that he is often hired before the cast and other crew. This editor is responsible for revising the filmed footage until it becomes the finished film. The editor begins by reading the script to get familiar with the story. It is important for the editor to know the script because film scenes are generally shot and edited out of sequence. When footage begins to come in, the editor reviews the footage and production notes provided by the director and production team. These notes contain details about the footage and the director’s comments about the footage. The editor then uploads or transfers the footage to computers in the editing bay and begins editing the footage into finished scenes. The editing bay is the control room with editing equipment, computers, monitors, and sound system where film editors manipulate plot, sound, graphics, and score to produce a well-constructed scene. This is a painstakingly detailed and time-consuming task

What is the purpose of a div?
Group of answer choices

all of the above

to add a background color or image to a web page section

to change the styling of multiple contained elements

to group elements

Answers

Answer:

I'd choose A, all of the above.

Reasoning Why:

I'll be taking you on a step to step process on why I inputted the answer.

The <div>, is basically like a container that you can group tougher, why this is great is because you can edit the div using a background-color effecting that group such as the following..

EXAMPLE OF BACKGROUND-COLOR DIV (background-color)

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample{

background-color:red;

/*Example of the Background-color attrib*/

/*You can also use the background-image attrib, however I recommend you checkout W3Schools, on that topic.*/

}

</style>

</head>

<body>

<div id="byexample">

<p>Just some random text to demonstrate.</p>

</div>

</body>

</html>

END OF EXAMPLE

You can also, in the <div> change multiple styles of an element in the div. However, if do want to change the styles of a single element you would need to nest it.

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample #text{

background-color:red;

color:yellow;

}

</style>

</head>

<body>

<div id="byexample">

<p id="text">Just some random text to demonstrate.</p>

</div>

</body>

END OF EXAMPLE

Lastly, you can group elements using divs, as stated in openclassroom (website).

Anyways, I hope this helped!

Happy coding!

Website designers work on the code and programming of a website, not the style or layout of the site.

Answers

Answer:

False

Explanation:

Website designers design how the site looks not works

You are running an 802.11g wireless router in mixed mode. You have three 802.11g wireless NICs connected to the router. A new user connects to an 802.11b wireless NIC. What will happen

Answers

Complete Question:

You are running an 802.11g wireless router in mixed mode. You have three 802.11g wireless NICs using the router. A new user connects using an 802.11b wireless NIC. What will happen?

Group of answer choices.

A. The user with 802.11b will access the network at 11Mbps while the users with 802.11g will access the network at 54 Mbps.

B. The user with 802.11b will not be able to communicate on the network.

C. The user with 802.11b will access the network at 11 Mbps. The users with 802.11g will access the network at 54 Mbps unless they are communicating with the 802.11b device,which will be at 11 Mbps.

D. All users will access the network at 11 Mbps.

Answer:

D. All users will access the network at 11 Mbps.

Explanation:

A 802.11g is one of the wireless network standards developed by the Institute of Electrical and Electronics Engineers (IEEE) which operates on a 2.4 GHz microwave bandwidth and as a result can only transmit over a short distance. The 802.11g has a data transfer rate or throughput of 54 megabits per seconds (Mbps).

Basically, the 802.11b is a similar standard to the 802.11g wireless standard that typically allows the transmission (transfer) of data for up to 11 megabits per seconds (Mbps).

In this scenario, you are running an 802.11g wireless router in mixed mode. You have three 802.11g wireless NICs using the router. A new user connects using an 802.11b wireless NIC.

Hence, what will happen is that, all the users will access the network at 11 Mbps.

The data type of 17.3 should be ________________.

int
float
str
list
Please answer quick.​

Answers

Answer:

float

Explanation:

Answer:

17.3 should be a float

Explanation:

Float type is a data that is contain a decimal number

If you would like to compare information on two different Web pages, you should _____.
scroll through the pages
the home page
use tabs
organize bookmarks

Answers

Answer:

Use Tabs

Explanation:

I had this lesson on odyessy ware and this was right the other guy is wrong

Answer:

Use Tabs is also correct on Edge nuity

Explanation:

i have Keyboarding and Apps

"Jan23" can be stored using which data type? O an alphanumeric string O a boolean operator o characters floating point numbers​

Answers

Answer:

Alphanumeric string

Explanation:

Answer:

a. an alphanumeric string

Explanation:

got it right on edge

WHY DOES THIS HAPPEN!?!??!?

Answers

Answer:

whats the qeustain?

Explanation:

What is the answer for 2.8.10 word games? This is what I have so far, but I can’t seem to be able to figure out the bananaSplit public strings.

Answers

Answer:

 public String bananaSplit(int insertIdx, String insertText) {

     return word.substring(0, insertIdx) + insertText + word.substring(insertIdx);

 }

Explanation:

Do you have the other parts of the WordGames class?

Do saving and loans associations have different categories?

Answers

Answer:

No

Explanation:

Because Savings and loan associations (S&Ls) are one of four types of "banks", there only one of four, not two of four

Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
questions
Online Content Site 1
Why isn't a good idea to study in bed?

Answers

Answer:

yes.. it is not good.

Explanation:

because its can calm our mindy & sleep quickly.

Answer:

I think avoiding stress and something/ anything disturbing your health is an effective conflict. In my opinion avoiding stress and anything disturbing your health is bad because the more time you ignore it the worse it get's.

Explanation:

I got it right on Edg.

Proof:

HELP ME!!! I WILL GIVE BRAINLY THINGY!!!

What does the code if (num2==50){ do?

Answers

Answer:

What subject is this?

Explanation:

is this math ?????????????????????

What are the most common forms of information?

Answers

Answer: web search

Explanation:

How should students properly use media in a presentation? Check all that apply
⬜incorporate images that are irrelevant but interesting
⬜engage viewers by adding variety
⬜stimulate the senses of the viewer
⬜clarify relevant details in the text
⬜select songs that decrease the presentation’s impact

Answers

Answer:

engage viewers by adding variety

stimulate the senses of the viewer

clarify relevant details in the text

Answer:

B,C,D for short

Explanation:

Jabari is writing pseudocode for a new video game he wants to create. What should he include in his pseudocode?

a
Everyday language that is easy to understand

b
Formatting with no indentations

c
The actual code used for the game

d
Words usually only programmers are familiar with

Answers

Answer:

The answer is "Option c".

Explanation:

The Pseudocode is a definition of actions in an algorithm or some other method of software engineering. It also uses regular programming language, formal conventions, and is associated with human learning rather than computer learning, and the wrong choice can be defined as follows:

In choice a, It is wrong because there are so many languages, and it is not easy to understand all.In choice b, It is wrong because it is used for better understanding.In choice d, it is wrong because words are also not only common to programmers.

Answer:

The actual code used for the game

can some one please help

Answers

Answer:

the thing is black for me. retake?

Explanation:

Communication of the binary data via the voltage level for each time interval.
a
voice assistant
b
machine language
c
voltage
d
digital signal

Answers

Answer:

D

Explanation:

Answer:

D. Digital signal

Explanation:

Edge 2022

Match the image to its type.


Rgb messes up taking pics from a iPhone 11 to a computer sorry it looks bad

Answers

Warm Colors:

Red flowersOranges

Cool Colors:

Blue skiesPurple butterflies

Neutral Colors:

Brown woodWhite birds

Reds, oranges, and yellows are considered warm, and greens, teals, blues, and purples are considered cool. Colors such as white, black, brown, or gray are all neutral.

What is the difference between an if-statement, an if-else statement, and an if-else-if statement? How are they similar?

This is in computer science principles

Answers

Answer:

Explanation:

If statement is saying one perspective. However, if else if is many different.


A programmer has a need to round many numeric values to the nearest integer. Which of the following best explains the benefit of using a list as a data abstraction in this situation

Answers

Answer:

Keeping the numeric values in a list makes it easier to apply the same computation to every data element.

Explanation:

A list or array in programming is a data structure, that has the location for each item it holds indexed. It eliminates the need to constantly create a variable to compute items of the same data types.

The list can store items of the same data type and iterate over them to compute the same calculation on each of them.

Lists are values which are seperated by commas and populated within square brackets. They are mutable and values could be easily accessed, appended, deleted or replaced. Hence, the use of a list for data abstraction is beneficial in that the round function could be easily applied to all the values in the list.

Rounding the values in the list coukd be easily done using for loop which takes each value in the list one at a time, rounds them to the nearest integer and places them into another list.

Using the a python list comprehension thus:

Given a list of numeric Values :

my_list = [1.2, 1.4, 1.5, 1.7]

rounded_int = [round(x) for x in my_list]

Learn more : https://brainly.com/question/20533392

Which of the following is an object-oriented language?

A. C
B. C++
C. BASIC
D. COBOL

Answers

Answer:

C++

Explanation:

Significant object-oriented languages include: (list order based on TIOBE index) Java, C++, C#, Python, R, PHP, Visual Basic.NET, JavaScript, Ruby, Perl, Object Pascal, Objective-C, Dart, Swift, Scala, Kotlin, Common Lisp, MATLAB, and Smalltalk.

The programs' structure is made obvious via OOP. OOP makes the C++ code easier to maintain, alter, and debug by encouraging “Don't Repeat Yourself” (DRY) programming practices. OOP allows for quicker development times and less code needed to create fully reusable apps. Thus, option B is correct.

What role of C++ as an object-oriented language?

The following are several justifications for calling C++ a partial or semi-object oriented language. The primary action is not a class action.

Object-oriented programming is supported by C++, but it is not a feature of the language itself. You don't even need to use an object once to construct a legitimate, well-coded, and brilliantly styled C++ program.

Therefore, Object-oriented programming can be implemented using C++'s core features. It contains classes and objects as well as the OOP principles of inheritance, encapsulation, abstraction, and polymorphism. It also has access to specifiers.

Learn more about language here:

https://brainly.com/question/29751978

#SPJ2

write a c++ program that prints the intial letter of any name​

Answers

Answer:

#include<iostream>

using namespace std;

int main(){

char str[20];

int i=0;

std::cout<<"Enter a name:" ;

cin>>str;

cout<<*str;

while(str[i]!='\0'){

if(str[i]==' '){

i++;

cin>>*(str+i);

}

i++;

}

return 0;

}

what are the atoms in grp one? periodic table. I am going to mark as brainliest ​

Answers

Answer:

Atoms in group 1:

H

Li

Na

K

Rb

Cs

Fr

How do graphic designers showcase their work?
Graphic designers create(Blank)
to showcase their work.


THIS IS A BIG TEST IM BEHIND AND CANNOT FAIL PLZ

Answers

Answer:

Platforms!

Explanation:

Answer:

portfolios

Explanation:

A portfolio is a collection of work done by a graphic designer. Graphic designers use them to display their work to their clients.

Other Questions
Please select the word from the list that best fits the definition A phone call Micheal walks 3.5 km every day . How far does he walk in 9 days . Write in meters Charles has 24 marbles. He has 6 more yellow marbles than blue marbles.Which equation represents this situation. Ultimate frisbee relies upon good sportsmanship since there are no referees and players must self-officiate the game. What is this known as? Group of answer choicesSpirit of the TeamSpirit of the FrisbeeSpirit of SportsmanshipSpirit of the Game To get to the campsite Rick has to canoe 10 miles, hike 2 miles, and then canoe another 5 miles. If Rick canoes at a steady rate of 5 mph and hikes at a constant 2 mph, how long will it take Rick to get to the campsite? Julieanne is sewing a red ribbon around the border of a blanket. The blanket measures 7 feet by 6 feet. How long does the ribbon need to be in order to go around the edge of the blanket one time?26 feet42 feet84 feet169 feet If a quadratic equation has no real solutions, is it still a function? I don't seem to know why whats the answer did anyone figure it out ? Which option is generally the most reliable source for health information?a commercial on televisiona website that ends in .coma frienda doctorPLS HELP!!!!!! PLEASE HELP ME............THANKS What is the missing numbers to this equation please ? - (? ?)=90 In this task, you will reference your notes from Task 1 and any additional sources you gather in order to create a slideshow presentation that responds to the following prompt: The United States is often called a nation of immigrants, and yet US history reveals many examples of anti-immigrant sentiment, actions, and legal restrictions. Which is true that America is a nation of immigrants or that it is a nation that does not support immigration? To successfully answer this prompt, reference and cite historical and recent events to support your argument. You dont need to include all the information from your notes in the tables above, but citing certain events or terms will strengthen your argument. Reference the Process section below to help create your presentation. How is California connected to Japan? How many moles of xenon do 5.66 x 10^23 atoms equal Melissa is making a piece for a stained glass window that has the shape and measures shown below. Point C is the center of the partial circle that forms one corner of the stained glass piece. Which area is the closest to the area of the stained glass piece in square inches? Use 3.14 for Which of the following elements has six valence electrons?BeBCNO Consider function f.f(x) = square root of 7x 21Place the steps for finding f-1(x) in the correct order. solve the equations 7(x+4)=21 iready EMERGENCY i+i+i+i=-8i= Which of the following is true of changes in momentum? A small force may produce a large change in momentum by acting over a short time interval.A large force may produce a small change in momentum by acting over a short time interval.A small force may produce a large change in momentum by acting on a very massive object.A small force may produce a large change in momentum by acting over a short distance.can you please explain why this is the answer as well and how you got it?