For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect.

# 1

def any_lowercase1(s):
for c in s:
if c.islower():
return True
else:
return False


# 2

def any_lowercase2(s):
for c in s:
if 'c'.islower():
return 'True'
else:
return 'False'


# 3

def any_lowercase3(s):
for c in s:
flag = c.islower()
return flag


# 4

def any_lowercase4(s):
flag = False
for c in s:
flag = flag or c.islower()
return flag

# 5

def any_lowercase5(s):
for c in s:
if not c.islower():
return False
return True

The code and its output must be explained technically whenever asked. The explanation can be provided before or after the code, or in the form of code comments within the code. For any descriptive type question, Your answer must be at least 150 words.

Answers

Answer 1

The use of the programing functions and example arguments that produces incorrect results are as detailed below.

How to Interpret the Programming function codes?

1) Function #1; any_lowercase1(s)

a) What this function does is that it checks for the first character of the string and then returns true if the character is a lowercase or else it returns false.

b) An example argument that produces incorrect results is;

Str="Hellofrance"

Output:- False

c) The reason why the argument is false is that;

Due to the fact that the string has the first character as an Uppercase, then the function will returns false and does not check until it finds a lowercase character.

2) Function#2; any_lowercase2(s)

a) What this function does is to return the string  “True” regardless of whatever may be the string input due to the fact that it contains a universally true “if-statement” which will always be true regardless of the input. The if statement is the one that checks for the character constant ‘c’ instead of the actual character.

b) An example argument that produces incorrect results is;

Str="HELLO”

Output:- True

c) The reason why the argument is false is that;

The "if" statement used in the function written as  ‘c’.islower() checks whether the character constant is as as lowercase or not rather than checking for the character in the string.

3) Function#3; any_lowercase3(s)

a) What this function does is that it checks whether the last character in the string is as a lowercase or not and then with that information, returns the true or false.

b) An example argument that produces incorrect results is;

Str="hellofrancE"

Output: false

c) The reason for the incorrectness of the example argument is;

The flag variable will keep updating for each character definitely until the last and thereafter, the flag status of the last character is returned as the function output. This then makes the function incorrect and as such, the function should employ a break when a lowercase character is encountered.

4) Function#4; any_lowercase4(s)

a) What this function does is “ flag = flag or c.islower()” for each character in the string. Now, initially the flag is set to false and it keeps itself updating for each character. The “or” operation is performed immediately true is encountered and the flag variable remains true. This function works correctly

b) An example argument that produces incorrect results is;

Str="Hellofrance"

5) Function#5; any_lowercase5(s)

a) The way that this function operates is that it returns true only when all characters in the string are seen to be lowercase otherwise if the function contains any uppercase characters it returns false.

b) An example argument that produces incorrect results is;

Str="hellofrancE"

Output:- false

Read more about Programming Codes at; https://brainly.com/question/16397886

#SPJ1


Related Questions

provides bandwidth-guaranteed logical communication . provides delay-guaranteed logical communication . provides reliable logical communication between processes none of above

Answers

provides bandwidth none of above

what is bandwidth ?

The quantity of information that can be transmitted in a specific amount of time over a particular sort of networking medium, such as a bus, is referred to as bandwidth.

The amount of information that can be transmitted over the internet in a certain period of time. The term "bandwidth" is frequently used interchangeably with "internet speed," although it refers to the quantity of information that can be transmitted across a link in a specific period of time, expressed in megabytes per second. In computers, bandwidth refers to the fastest possible speed at which data flow along this specific route. There are three distinct kinds of bandwidth: network bandwidth, data throughput, and digital bandwidth.

To learn more about bandwidth

https://brainly.com/question/28233856

#SPJ4

while preparing a 2021 return for a taxpayer, tyreek, a paid preparer, determined that the taxpayer had omitted certain items of income when they filed their prior-year return. tyreek should advise the taxpayer promptly of the fact of such omission and: advise them of the consequences of not amending the previous year's return. make an adjustment for the previous year's omission on the current-year return. refer the taxpayer to his supervisor. refuse to prepare the current-year return until the prior-year return is amended.

Answers

Given the facts referred to in the given scenario, Tyreek will handle the situation by promptly alerting taxpayers to the fact of such omissions and adjusting the previous year's omissions in the current year's tax returns.

A omission:

Mistakes are mistakes that IT professionals make. B. Errors in Software Developer's Code. An omission is an example of incomplete work, or an example of failure to prevent undesirable consequences. Transmission of unencrypted data intercepted by cybercriminals.

Why is the omission  used?

Omissions occur when important information is not reported or is incomplete. Omissions can be thought of as news that should have been reported but left out of the news we read, watch, or hear.

Learn more about omission :

brainly.com/question/24254789

#SPJ4

Emerging technologies would make better the life of developing countries

Answers

Answer:

please refer to my other answer when you previously asked this question!

which of the following function declarations correctly guarantee that the function will not change any values in the array argument?

Answers

e. void f1(const int array[ ], int size);

So, if you want a function declaration which guarantee that the function will not change any values in the array argument use the keyword "const".

It creates a constant reference to an array.

What is Array in Programming languages?

A collection of elements (values or variables) that are each identified by at least one array index or key make up an array, which is a type of data structure.

Depending on the language, additional data types that describe aggregates of values, like lists and strings, may overlap (or be identified with) array types.

Array data structures are frequently used to construct array types, but other tools like hash tables, linked lists, or search trees may also be used. The default array data structure in Python is a list.

Array definition in different Languages:

JavaScript var ages = [49, 8, 2, 19, 16];

Python          ages = [49, 8, 26, 19, 6]

C#                  int[] ages = {9, 8, 26, 19, 16};

Java          int[] ages = {49, 8, 26, 1, 16};

C++                  int ages[] = {49, 8, 6, 19, 16};

To know more about Array, visit: https://brainly.com/question/19634243

#SPJ4

who is in a scrum team

Answers

Who is in the scrum team?

Product OwnerScrum Master, andDevelopment team

combines the data from a list with the content of a document to provide customized letters certificates and other publications.

Answers

Mail merge combines the data from a list with the content of a document to provide customized letters certificates and other publications.

What is mail merge?

The ability to send the same letter or document to various recipients using mail merge is a feature found in most data processing programs. It allows for the integration of a single form template with a data source containing details such as the recipient's name, address, and other supported and predefined data.

Mail merge primarily automates the distribution of bulk mail to clients, subscribers, or the general public.

Data file and letter template are the two documents that mail merge uses. Information about the recipients who will receive the letter is contained in the data file. This document can be a spreadsheet or database with distinct fields for each type of data to be combined in the letter.

Learn more about mail merge

https://brainly.com/question/20904639

#SPJ4

antivirus software can use techniques called to detect malware by analyzing the characteristics and behavior of suspicious files.

Answers

Antivirus software is an integral part of keeping our computers and data secure. It uses specialized techniques such as:

Signature-based detectionHeuristics-based detectionSandboxing to detect malicious software

Antivirus software can use to detect malware by analyzing the characteristics and behavior of suspicious files:

Signature-based Detection: This technique involves scanning and comparing a suspicious file to a database of known malware signatures. If the signature of the file matches one in the database, the antivirus software will flag it as malicious.Heuristics-based Detection: This technique uses algorithms to analyze the behavior of a file and detect malicious behavior. The antivirus software will look for suspicious code, suspicious network traffic, or any other potentially malicious activity.Sandboxing: This technique involves running a suspicious file in a virtual environment before it is allowed to run on the actual system. This virtual environment will simulate the actual system, allowing the antivirus software to detect any malicious behavior.

Learn more about Antivirus software: https://brainly.com/question/17209742

#SPJ4

add criteria to this query to return only the records where the value in the credits field is less than 90 and the value in the classification field is jr or sr (without punctuation). run the query to view the results.

Answers

To add criteria to this query to return only the records :

You clicked the Credits field's criteria row, changed the Credits field's criteria to >90, clicked the Classification field's criteria row, changed the Classification field's criteria to Jr, clicked the classification field's or row, clicked the classification field's or row, changed the classification field's or row to Sr, clicked the credits field's or row, and changed the credits field's or row to >90. In the Design Ribbon Tab in the Results Ribbon Group, you clicked the Run button.

What is a database query?

A query is either a request for data results from a database, an action on the data, or both. Queries allow you to get answers to simple questions, perform calculations, combine data from different tables, and add, change, or delete data from databases. Provides information about how SQL databases perform queries.

Why use queries?

Queries are requests for data results and actions on data. Queries can be used to answer simple questions, perform calculations, combine data from different tables, and add, change, or delete table database.

Learn more about Query :

brainly.com/question/25694408

#SPJ4

Learning Objectives
Implement 2 different machine learning algorithms

Stochastic Gradient Descent
ID3 Decision Tree
Description
This assignment is focused on machine learning, mainly on the implementation of 2 different algorithms - Stochastic Gradient Descent & ID3 decision tree. The assignment is divided into two sections, each for one unique ML algorithm.

Answers

Answer:

you just need to research

Explanation: its easy once you get the hang of it

A well-liked optimization technique for building models in machine learning is stochastic gradient descent. A well-liked decision tree technique for classification issues in machine learning is [tex]ID_3[/tex]

What is stochastic gradient descent  and [tex]ID_3[/tex]?

A well-liked optimization approach for training models in machine learning is stochastic gradient descent. As it changes the model weights based on a small batch of randomly chosen samples rather than the complete dataset, it is especially helpful for huge datasets. Implementing the SGD algorithm entails the following steps:

1. Initialize the model weights at random.

2. The dataset was divided into smaller groups.

3. Every batch:

Determine the loss function's gradient with respect to the weights.Utilize the gradient and a learning rate to update the weights.

4. Until convergence or the maximum number of iterations is achieved, repeat steps 2-3.

A well-liked decision tree technique for classification issues in machine learning is ID3. The dataset is separated recursively depending on the feature that yields the greatest information gain, and this process is repeated until every instance in a leaf node belongs to the same class. Implementing the ID3 algorithm entails the following steps:

1. Determine the dataset's overall entropy.

2. For each attribute:

After the dataset has been divided based on that attribute, compute its entropy.Determine the feature's information gain.

3. As the separating feature, pick the one that provides the most information gain.

4. The splitting feature should be the decision rule for a new node in the decision tree.

5. Apply steps 1-4 repeatedly until all subsets of the dataset produced by the splitting rule have been processed.

Therefore, a well-liked optimization technique for building models in machine learning is stochastic gradient descent. A well-liked decision tree technique for classification issues in machine learning is [tex]ID_3[/tex]

Learn more about stochastic gradient descent, here:

https://brainly.com/question/30881796

#SPJ2

given the declaration of a structure whose tag is date, write the declaration of the following variables enrolled on, paid on, and completed on, each of which is of type date.

Answers

The declaration of a structure whose tag is date,the declaration of the following variables enrolled on---- DATE enrolled_on,

Variable paid on ----- paid_on,

Variable completed on ------ completed_on;

Variable programming :

In computer programming, a variable is an abstract storage space paired with an associated symbolic name that contains a known or unknown amount of information called a value. More simply, a variable is a named container for a particular set of bits or data types.

What is a variable ?

Variables are used to store information that can be referenced and manipulated in computer programs. It also provides a way to label your data with meaningful names, making your program easier to understand for readers and yourself. It's convenient to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can be used throughout the program.

Learn more about variable programming :

brainly.com/question/9238988

#SPJ4

which of the following is the most critical component of communications, from a network resiliency point of view?

Answers

From a network resiliency point of view, the most critical component of communications is IEC/POPS network.

IEC/POPS Network

The Internet Exchange Carrier (IEC) and Points of Presence (POPs) network is a critical component of the communications infrastructure, as it enables the exchange of internet traffic between different internet service providers (ISPs).

The IEC operates one or more POPs, which are physical locations where ISPs can connect their networks to the IEC's network. The IEC's network is designed to be a neutral platform that allows different ISPs to interconnect their networks and exchange traffic without the need for direct peering agreements between each ISP. This helps to reduce the complexity of the internet infrastructure and allows ISPs to offer their customers more comprehensive internet access.

The IEC/POPS network is an important component of the overall communications infrastructure, as it plays a key role in enabling the flow of internet traffic between different networks. Without the IEC/POPS network, ISPs would need to establish direct peering agreements with every other ISP that they want to exchange traffic with. This would significantly increase the complexity of the internet infrastructure and make it more difficult for ISPs to offer their customers access to a broad range of online content and services.

In summary, the IEC/POPS network is a critical component of the communications infrastructure, as it enables the exchange of internet traffic between different ISPs and plays a key role in enabling the flow of internet traffic throughout the global internet.

Learn more about Network Infrastructure here:

https://brainly.com/question/15021917

#SPJ4

_______ allow you to track and monitor social activity around certain keywords, phrases and even specific users or locations.

Answers

Search streams allow you to track and monitor social activity around certain keywords, phrases and even specific users or locations.

How do I seek all flow systems?

JustWatch is a seek engine that permits you to look all streaming offerings at once. You can clear out out your outcomes with the aid of using genre, launch date, or rating. It consists of maximum fundamental streaming systems, tv networks, area of interest streaming systems, sports, or even library systems like Kanopy.

What is the flow platform?

By definition, a streaming platform is an on-call for on line leisure supply for TV shows, films and different streaming media. For example, suppose of factors like Hulu, Netflix, Amazon Prime Video, Vimeo, and Sundance Now.

How does streaming work?

Just like different facts this is despatched over the Internet, audio and video facts is damaged down into facts packets. Each packet includes a small piece of the file, and an audio or video participant withinside the browser at the purchaser tool takes the float of facts packets and translates them as video or audio.

Learn more about search stream:

brainly.com/question/512733

#SPJ4

which of the following is a difference between variable interval reinforcement schedules and variable ratio reinforcement schedules?

Answers

Unlike fixed interval reinforcement schedules, fixed ratio reinforcement schedules are based on behaviors.

What is reinforcement schedules?

A part of operant conditioning is a schedule of reinforcement (also known as instrumental conditioning). It consists of a plan for choosing when to reward behavior. Consider whether to encourage based on the amount of time or the quantity of responses.

The two main types of reinforcement schedules are continuous reinforcement, which encourages a response continuously, and partial reinforcement, which reinforces a response only periodically.

The response rate and resistance to extinction of the behavior are substantially influenced by the sort of reinforcement schedule adopted.

For the field of behavioral science, decision behavior, behavioral pharmacology, and behavioral economics, schedules of reinforcement have significant ramifications.

To know about reinforcement learning, visit: https://brainly.com/question/29764650

#SPJ4

suppose that the variable alivecnt initially contains the value 0x02. what will be the content of this variable (in hex notation) after execution of the following subroutine?

Answers

Initially, ALIVECNT is 0x02.

Since it is decremented by 1 and becomes 0x01 in the subroutine, since the value obtained is not zero BNZ BAend  instruction branches to BAend where RETURN is located and subroutine execution is complete.

What is hex notation?

The base (radix) of the numeral system known as hexadecimal notation is 16. employs 16 digits, as opposed to 10 in decimal notation or 2 in binary: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

Binary notation, which is challenging to understand and prone to error when handled by humans, is conveniently represented by programmers using this method.

Since 16 is a power of 2, the two notational systems can be simply converted into one another.

In contrast, because decimal numbers are in base 10 and not a power of 2, they are more challenging to convert into binary numbers.

Programmers utilize the hexadecimal numbering system to make the binary numbering system simpler.

To know more about hex notation,  visit: https://brainly.com/question/26760950

#SPJ4

when finding the test value for an f test, the smaller of the two variances should be placed in the numerator.

Answers

This is true, of course. The smaller of the two variances makes up the numerator of the F statistical test, while the bigger variance makes up the denominator.

What does variance mean?

Variance is the expected squared variation of a stochastic process from its population mean or sample mean in probability theory and statistics. Variance is a measure of dispersion, or how far apart from the mean a group of data are from one another. Descriptive analytics, statistical inference, testing hypothesis, goodness of fit, and Monte Carlo sampling are just a few of the ideas that make use of variance. In the sciences, where statistical data analysis is widespread, variance is a crucial tool.

To know more about Variance
https://brainly.com/question/16269880
#SPJ4

ai has the potential to have a detrimental effect on the labor market for various professions because of . multiple choice mechanicalization manualization computerization

Answers

AI has the potential to have a detrimental effect on the labor market for various professions because of computerization.

What impact will AI have on the job market?

AI and machine learning are on many lists of the most important skills in the job market. Jobs requiring AI or machine learning skills are projected to grow by 71% over the next five years.

Is artificial intelligence a threat or an advantage?

The only threat AI poses is unemployment, another predictable and ongoing problem. Still, AI offers job creation opportunities. AI therefore has more advantages compared to threats and represents a different solution than threats.

What impact will robots and artificial intelligence have on the labor market in the future?

Robots and AI will take some jobs from humans, but they will also create new ones. Since 2000, many manufacturing jobs have been slowly lost to robots and automation systems. Of which he is 1.7 million. Meanwhile, AI is projected to create 97 million new jobs by 2025.

Learn more about Artificial intelligence :

brainly.com/question/25523571

#SPJ4

after you enter the details for the first selected recipient in the new address list dialog box select to add another recipient

Answers

To add another recipient, click the "Add Another Recipient" button located at the bottom of the New Address List dialog box.

How you select to add another recipient?

The "Add Another Recipient" button is located at the bottom of the New Address List dialog box and is used to add additional recipients to the address list. This allows users to quickly and easily create an address list with multiple contacts.

Once the details for the first recipient have been entered, the user can click the "Add Another Recipient" button to open a new dialog box to enter the details for the next contact. This allows users to quickly and easily create an address list containing multiple contacts without having to manually enter all the information for each recipient.

Learn more about Programming: https://brainly.com/question/16397886

#SPJ4

use entertainmentagencymodify; (select concat(custfirstname,custlastname) as custname, custphonenumber from customers c join engagements e on c.customerid

Answers

dgaiugek'g

awEPGBkarhKG
<BG"B

The clients and activities database in the entertainmentagencymodify table is queried to retrieve the client name and phone number:

concatenate (custfirstname,custlastname) as (custname,custphonenumber)

from clients c

join engagements e on customerrid = engagements e.customerrid;

What is database?
A database is a set of information that is organised for easy management and updating. Data records or files containing information, including as sales, customer information, financial data, and product information, are often aggregated and stored in computer databases.

The customer identity and phone number of customers linked to contracts in the entertainment agency modify dataset will be returned by this query. The customer's first and last names are combined into a single field using the concat function, and the customer and engagement tables are then joined using the join clause based on the usually by way field. We will be able to quickly get the customer's phone number and name for every interaction thanks to this.

to learn more about database

https://brainly.com/question/28033296

#SPJ4

diskpart has encountered an error: data error (cyclic redundancy check). see the system event log for more information. fix

Answers

Here we saw the system event log for more information.

What is system?

system is the set of ideas or the  rules for organizing something; a particular way of doing something.

DiskPart has encountered by an error data error cyclic redundancy check see to the  system event log. This erroneous may occur due to several reasons. However, the primary reasons include by the  hard drive corruption, and it has  registry file corruption, misconfigured files, of the  cluttered disk, unsuccessful to the  program installation, etc.

To know more about system click-

https://brainly.com/question/25594630

#SPJ4

How would emerging technology make better the life of developing countries

Answers

Answer:

With the age of technology evolving rapidly, certain technologies can help improve the quality of life in certain developing countries. For example, such appliances/technology can be air purifiers that help improve the air quality for people. Think about it, technology is actively evolving and getting better and more efficient in our society.

hopefully this is what you meant :)

7.3.2. rts/cts frames. what is the purpose of rts (request to send) and cts (clear to send) frames in wifi (802.11) networks? select one or more of the answers below. [hint: check two answers below].

Answers

In wifi networks, rts and cts frames are used to manage data flow between devices and lessen collisions between many transmitting devices.

WIFI: What is it?

The IEEE 802.11 family of standards, which are frequently used for local area networking for devices and Online access, forms the foundation for the Wi-Fi family of wireless network protocols, an Australian invention that enables adjacent digital devices to exchange information using radio waves. In order to connect desktop and laptop computers, tablets, cell phones, smart TVs, printers, and multiroom audio to one another and to a wireless router so they can access the Internet, these are the most common computer networks in the world. People are used in home and small improving organizational all over the world.

To know more about WIFI
https://brainly.com/question/13267315
#SPJ4

collaborating with a social scientist to provide insights into human bias and social contexts is an effective way to avoid bias in your data.

Answers

Yes, this is true. Working with a social scientist can help to identify and understand any potential social biases that may exist in the data, as well as understanding how social contexts may affect the data. This can help to ensure that the data is as accurate and unbiased as possible, which is critical when making important decisions or drawing conclusions based on the data.

How Collaborating with a Social Scientist Can Help Avoid Bias in Data?

Data is an essential part of making informed decisions, and ensuring that the data is accurate and unbiased is of the utmost importance. One way to help avoid bias in data is to collaborate with a social scientist, who can provide insights into potential human biases and social contexts that may be influencing the data.

Human bias can come in many forms, such as personal beliefs, values and opinions, cognitive biases, and even cultural and societal biases. A social scientist can help to identify these biases and understand how they may be impacting the data. By recognizing and understanding these potential biases, data analysts can adjust for them, or at least be aware of their impact when interpreting the data.

Social context is also an important factor in understanding data. Social scientists can help to identify and analyze the social and cultural factors that may be influencing the data, such as the population being studied, or the locations in which data was collected. This can help to ensure that the data is appropriately contextualized and interpreted.

Learn more about social scientist :

https://brainly.com/question/21209603

#SPJ4

if an arithmetic expression isn't evaluated the way you want it to be due to the order of precedence, you can override that order by using

Answers

If an arithmetic expression isn't evaluated the way you want it to be due to the order of precedence, you can override that order by using parenthesis. That is the application of writing to javascript code.

What is Javascript?

JavaScript is a programming language that is one of the core technologies of the World Wide Web, along with HTML and CSS. By 2022, 98% of websites will use client-side JavaScript to power web pages, often integrating third-party libraries. All major web browsers have their own JavaScript engine for running code on the user's device.

JavaScript is a high-level, often just-in-time compiled, language that adheres to the ECMAScript standard. It features dynamic writing, prototype-based object orientation, and top-notch features. It spans paradigms and supports event-driven, functional, and imperative programming styles. It has application programming interfaces (APIs) for working with text, dates, regular expressions, standard data structures, and the Document Object Model (DOM).

Learn more about javascript https://brainly.com/question/16698901

#SPJ4

Write the c++ program, which, depending on the choice made by the user (checked through the
switch..case construct) will:
a. check if the entered numeric value is the Armstrong number
b. check if the entered number (notice: integer or floating point!) is a palindrome
c. generate the Fibonacci series for the numbers of the given range
d. end operation

Answers

The way to depict the c++ program, depending on the choice made by the user will be:

Take instructions from user in a, b, c, dthen in switchcase a: (copy paste armstrong code)case b:(copy paste palindrome code)case c:(copy paste fibonacci series code)default: break;print(Program Ended)just declare the variables before switch

What is a program?

A series of instructions written in a programming language for a computer to follow is referred to as a computer program. Software, which also includes documentation and other intangible components, includes computer programs as one of its components. Source code is a computer program's human-readable form.

It should be noted that C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports different ways of programming such as procedural, object-oriented, functional, and so on. This makes C++ powerful as well as flexible.

Learn more about program on:

https://brainly.com/question/23275071

#SPJ1

program Vingt-et-un is a dice game (known as Blackjack in the USA), where a player competes against the computer (house). The goal of the game is to score 21 points, or as near as possible without going over. The two players take turns throwing two dies as many times as desired and adding up the numbers thrown on each round. A player who totals over 21 is bust and loses the game. The player whose total is nearest 21, after each player has had a turn, wins the game. In the case of an equality high total, the game is tied. The game is over at the end of a round when: One or both players are bust. Both players choose to stay. Notes Once a player totals 14 or more, one of the dies is discarder for the consecutive turns. The house must throw the dice until the total is 17 or higher. At 17 or higher, the house must stay. Project Requirements The program will start by prompting the user for the name of the player. The game will be implemented using a menu-driven interface that provides the following options: See the Rules. Play Vingt-et-un. Quit. If the user chooses 1 from the menu, display the rules of the game. If the user chooses 2 from the menu Go into a loop of rounds where player & house will take turns throwing the dice. At each turn the system will ask the player/house whether to stay or roll. If the house has a running total of 17 or higher, it stays, and the turn passes to the player. If the player/house option is to roll, the program simulates the roll of the two dies and updates & displays the player’s running total. If the player/house starts the round with an accumulated total of 14 points or more, only one die will be rolled. Once the game is over the system will display the result Winner Loser Tie If the user chooses 3 from the menu, display a good-bye message and quit. The users can play the game as many times as they wish until they choose 3 to Quit. For PYTHON

Answers

Program Vingt-et-un is a dice game

#import modules

import random

#define variables

playerName = ""

playerTotal = 0

houseTotal = 0

dice1 = 0

dice2 = 0

menuOption = 0

#display the menu

def displayMenu():

   print("\nVingt-et-un Game Menu \n")

   print("1. See the rules. \n")

   print("2. Play Vingt-et-un. \n")

   print("3. Quit. \n")

#get the name of the player

def getPlayerName():

   global playerName

   playerName = input("Please enter your Name: ")

#display the rules of the game

def showRules():

   print("Vingt-et-un is a dice game where a person faces off against the computer (known as Blackjack in the USA) (house). The objective of the game is to score 21, or as close to it as you can without going over. The two players alternately toss two dice as many times as they like, summing up the results after each round. If a player's total exceeds 21, they bust and lose the round. After each player has had a turn, the game is won by the one whose total is closest to 21. The game is tied if both teams have a high total. When either one or both players are bust, the round is done and the game is ended. Both players decide to continue.")

#roll the dice

def rollDice():

   global dice1

   global dice2

   dice1 = random.randint(1,6)

   dice2 = random.randint(1,6)

   print("Dice 1: " + str(dice1))

   print("Dice 2: " + str(dice2))

#calculate the players total

def calculatePlayerTotal():

   global playerTotal

   global dice1

   global dice2

   playerTotal += dice1 + dice2

   print("\nYour total is: " + str(playerTotal))

#calculate the house total

def calculateHouseTotal():

   global houseTotal

   global dice1

   global dice2

   houseTotal += dice1 + dice2

   print("\nHouse total is: " + str(houseTotal))

#player turn

def playerTurn():

   global playerTotal

   while True:

       playerChoice = input("\nDo you want to stay or roll? (s/r): ")

       if playerChoice == "s":

           print("\nYou chose to stay.")

           break

       elif playerChoice == "r":

           if playerTotal >= 14:

               rollDice()

               calculatePlayerTotal()

           else:

               rollDice()

               calculatePlayerTotal()

       else:

           print("\nPlease enter either s or r.")

#house turn

def houseTurn():

   global houseTotal

   while True:

       if houseTotal >= 17:

           print("\nHouse chose to stay.")

           break

       else:

           rollDice()

           calculateHouseTotal()

#print the winner

def printWinner():

   global playerTotal

   global houseTotal

   if playerTotal > 21:

       print("\n" + playerName + " is bust. House won!")

   elif houseTotal > 21:

       print("\nHouse is bust. " + playerName + " won!")

   elif playerTotal == houseTotal:

       print("\nIt's a tie.")

   elif playerTotal > houseTotal:

       print("\n" + playerName + " won!")

   else:

       print("\nHouse won!")

#main function

def main():

   global menuOption

   getPlayerName()

   while menuOption != 3:

       displayMenu()

       menuOption = int(input("\nPlease select an option (1-3): "))

       if menuOption == 1:

           showRules()

       elif menuOption == 2:

           playerTurn()

What is program?

 Program is a set of instructions that are followed by a computer to execute a task or perform a specific function. Programs are typically written using a programming language, composed of a set of instructions that a computer can understand and execute. Programs range from simple, single-line commands to complex and lengthy applications. Programs are essential for the operation of modern computers, as they provide the instructions that allow computers to perform useful tasks, such as running software applications, processing data, and connecting to the internet.

to learn more about program

https://brainly.com/question/28224061

#SPJ4

Which of the following Windows tools is used to measure how well software and hardware are performing by displaying statistics in real time?
a. Performance Monitor
b. System Configuration
c. Data Sources
d. Event Viewer

Answers

Option A. Performance Monitor is a Windows tool that can be used to measure and monitor the performance of software and hardware. It displays statistics in real time, allowing users to track the performance of their systems and make necessary changes to optimize it.

Which Windows' tools are used to measure how well software and hardware are performing by displaying statistics in real time?

Option A. Performance Monitor

Performance Monitor is an invaluable Windows tool used to measure and monitor the performance of software and hardware. It displays statistics in real-time, allowing users to keep track of their system's performance and make necessary adjustments to optimize it. Performance Monitor provides detailed information such as:

Processor usageMemory usageMemory cacheNetwork and disk usageOverall system performance

Learn more about Windows tools: https://brainly.com/question/1323179

#SPJ4

In a private network, N, that uses a NAT box, which of the following could enable an outside host x to make first contact with inside host y? (Check all that apply) A. x requests and receives y's internal address from N'S NAT box B. x can bypass N'S NAT box and send directly to the hardware address of y C. y has a domain name that can be translated by an internal domain name server

Answers

A is correct because the NAT box can provide x with y's internal address, allowing x to make contact. D is correct because x can send a broadcast request to the NAT box, which will then forward the request to y. B is incorrect because x cannot bypass the NAT box, as this would compromise the security of the private network. C is incorrect because y does not need a domain name to enable x to make contact; x can simply use the internal address provided by the NAT box.

The Benefits of Using a NAT Box in a Private Network

In today's increasingly digital world, it is important to ensure that private networks are secure and protected from malicious actors. One of the most effective ways to do this is through the use of a NAT box, which acts as a gateway between the private network and the public internet. A NAT box is able to provide a secure and private connection between two systems in a private network, while also providing a way for outside hosts to make contact with inside hosts.

A NAT box works by providing a translation between the inside and outside addresses of a system. By using a NAT box, an outside host can request the internal address of an inside host, allowing them to make contact without compromising the security of the private network. Additionally, a broadcast request sent to the NAT box can be forwarded to the inside host, allowing for two-way communication. This makes the NAT box an invaluable tool for secure communication between two hosts in a private network.

Learn more about private network:

https://brainly.com/question/6888116

#SPJ4

ring stick up cam battery hd security camera with custom privacy controls, simple setup, works with alexa - white

Answers

A fantastic option for home protection is the Ring Stick Up Cam Battery HD Security Camera with Custom Privacy Controls. It is simple to install, offers personalized privacy controls, and integrates with Alexa.

Who defines privacy?

The capacity to hide oneself or information about oneself allows a person or group to express themselves in a selective way. The concepts of acceptable use and information protection can be included in the security realm, which can also partially overlap with privacy realm. Body integrity is another sort of privacy. Many nations' privacy rights, and in certain cases, constitutions, include protections from unauthorized intrusions of private by the government, businesses, or people.

To know more about privacy
https://brainly.com/question/14603023
#SPJ4

What happens when you remove the remaining values of the time line script displayed at the right of your screen?

A. It will not work at all
B. It will revert all scripts automatically
C. It will still work
D. It will not be visible
E. None of the above.

Answers

The thing that happens when you remove the remaining values of the time line script displayed at the right of your screen is option : D. It will not be visible

What does a lined script serve?

A script's lining is one that improves coverage. A list of the scripts you have access to appears at the top of the script tab.

The navigation bar at the top of the screen and the current script are both highlighted in blue. In the case of this, Simply choose the new script you want to use to switch scripts.

Therefore, To create a new script, write its name in the box labeled "New Script Name" at the top of the page, then click the Create Script button. Swipe the script you wish to delete from right to left, and then click the red button to delete it. Press the info button to access a script (i).

Learn more about line script from

https://brainly.com/question/14659373
#SPJ1

which of the following can replace /* missing condition */ so that the printdetails method cannot cause a run-time error?

Answers

borrower !=null

"borrower !=null" is the required code that can replace missing condition, so that the printdetails method cannot cause a run-time error.

What is a Run-time error?

A runtime error is one that occurs while a program is being executed. In contrast to compilation errors, which occur during program compilation, runtime errors occur only during program execution. Runtime errors indicate program bugs or issues that the developers anticipated but were unable to resolve. Inadequate memory, for example, can frequently result in a runtime error.

Runtime errors are typically displayed in a message box with a specific error code and its corresponding description. It is quite common for the computer to become noticeably slower before a runtime error appears.

To know more about Run-time error, visit: https://brainly.com/question/28910232

#SPJ4

Other Questions
Southern state governments/southerners attempted to restrict the citizenship rights of freed slaves as much as possible following abolition. What right does the 15th amendment to the Constitution grant? Identify and Explain two ways that southern state governments/southerners attempted to undermine the 15th amendment as it applied to freed slaves. Explain why each policy was especially harmful to freed slaves. 7. Find the value of x . First decide which trig function to use! 12.37.910.125.4 by studying the chemicals in rare plants that grow only in rainforests, scientists hope to discover new life-saving medicines. chances of finding such new medicines are reduced by find all states for the lowest energy electronic configuration for the titanium atom allowed by the pauli principle. you do not have to specify the j quantum number. arrange the states in order of increasing energy. describe the transformation from snow to ice by arranging the following steps in order.1. Pressure melts snow 2. Refreezing forms ice 3. Tightly packed fin forms. 4. Snow packs together. Friction always acts in a direction _____to the direction of motion. The following are the dimensions of each room in a house:Living room = 20 ft x 15 ft Kitchen = 12 ft x 10 ftBedroom 1 = 12 ft x 12 ft Bedroom 2 = 12 ft x 10 ftBathroom = 8ft x 12 ftWhat is the total square footage of the house? something meant to be done or used only temporarily or for a period of time is this:______. what type of video campaign should you use if your goal was to increase purchase intent for your products? What is another name for interest group? le place has sales of $439,000, depreciation of $32,000, and net working capital of $56,000. the firm has a tax rate of 34 percent and a profit margin of 6 percent. the firm has no interest what is the amount of the operating cash flow? a. $49,384 b. $52,616 c. $54,980 d. $58,340 e. $114,340 What is negotiating to reach a mutual agreement? 20 List the steps of the perpendicular bisector construction in order from 1 to 4 Other things the same, if workers and firms expected prices to rise by 2 percent but instead they rise by 3 percent, then: _________ brandon is on one side of a river that is 70 m70 m wide and wants to reach a point 300 m300 m downstream on the opposite side as quickly as possible by swimming diagonally across the river and then running the rest of the way. find the minimum amount of time if brandon can swim at 2 m/s2 m/s and run at 4 m/s.at 4 m/s. (use decimal notation. give your answer to two decimal places.) the minimum amount of time is s A ellano le gusta el museo.le gusta el museo. solve the system of equations using elimination: 3x-2y=2 and 2x-5y=27 Which of the following bestdescribes the impact ofhaving an unreliable narrator? If tortilla chips are a normal good, what happens to equilibrium price and quantity when there is an increase in income?a) Equilibrium price decreases and equilibrium quantity decreases.b) Equilibrium price increases and equilibrium quantity increases.c) Equilibrium price increases and equilibrium quantity decreases.d) Equilibrium price decreases and equilibrium quantity increases. How did Napoleon's loss in the Battle of Trafalgar affect Europe?