Answer:
Explanation:
The following code is written in Python and is a full Two player tic tac toe game on a 3x3 grid that is represented by numbers per square.
# Making all of the main methods of the game
board = [0,1,2,
3,4,5,
6,7,8]
win_con = [[0,1,2],[3,4,5],[6,7,8],
[0,3,6],[1,4,7],[2,5,8],
[0,4,8],[2,4,6]] # possible 3-in-a-rows
def show():
print(board[0],'|',board[1],'|',board[2])
print('----------')
print(board[3],'|',board[4],'|',board[5])
print('----------')
print(board[6],'|',board[7],'|',board[8])
def x_move(i):
if board[i] == 'X' or board[i] == 'O':
return print('Already taken!')
else:
del board[i]
board.insert(i,'X')
def o_move(i):
if board[i] == 'X' or board[i] == 'O':
return print('Already taken!')
else:
del board[i]
board.insert(i,'O')
# Creating the main loop of the game
while True:
turn_num = 1
board = [0,1,2,3,4,5,6,7,8]
print('Welcome to Tic-Tac-Toe!')
print('AI not implemented yet.')
while True:
for list in win_con: #check for victor
xnum = 0
onum = 0
for num in list:
if board[num] == 'X':
xnum += 1
elif board[num] == 'O':
onum += 1
else:
pass
if xnum == 3 or onum == 3:
break
if xnum == 3 or onum == 3: # break loops
break
if turn_num > 9: # Check if there are any more moves available
break
show()
if turn_num % 2 == 1:
print('X\'s turn.')
else:
print('O\'s turn.')
move = int(input('Choose a space. '))
if turn_num % 2 == 1:
x_move(move)
else:
o_move(move)
turn_num += 1
if xnum == 3: #If game ends
print('X Won!')
elif onum == 3:
print('O Won!')
else:
print('Draw!')
play_again = input('Play again? Y or N ')
if play_again == 'Y' or play_again == 'y':
continue
else:
break
Write a python program that: - Defines a tuple of 5 integer numbers - prints the tuple - Appends a new value to the end of the tuple - prints the tuple again Please note that appending a new value to a tuple will change the tuple. However, as you learned in Unit 5, tuples are immutable i.e. do not change. Therefore, to solve this problem, you need to find a way to change a tuple.
Answer:
The program is as follows:
my_tuple = (1,2,3,4,5)
print(my_tuple)
mylist = list(my_tuple)
mylist.append(6)
my_tuple = tuple(mylist)
print(my_tuple)
Explanation:
This defines a tuple of 5 integers
my_tuple = (1,2,3,4,5)
This prints the tuple
print(my_tuple)
To add new element to the tuple; First, we convert it to list. This is done below
mylist = list(my_tuple)
Then, an item is appended to the list
mylist.append(6)
The list is then converted to tuple
my_tuple = tuple(mylist)
This prints the tuple
print(my_tuple)
To lose weight, you must _______.
a.
increase exercise and increase caloric intake
b.
increase exercise and decrease caloric intake
c.
decrease exercise and increase caloric intake
d.
decrease exercise and decrease caloric intake
Answer:
B
Explanation:
because you need to exercise and eat or drink less calories
Answer: b. increase exercise and decrease caloric intake
Explanation:
What is the advantage of using shortcuts
Answer: There can be advantages and disadvantages.
for example, if you were in the woods with a pathway, and a clear way that might be faster and a shorter way of getting out. You may take the shortcut leading to where you didn't want to go leading to you getting lost or, it could be the same time but with more challenges.
An example of shortcuts to it's advantage is when you're reading a text and you don't understand the word. It's much easier when you hear it being read out to you when the reader uses tone to kind of give you a hint if the connotation is negative or positive, A good example of this is the word unique let's use this sentence "She was very unique, and that's what made her cool!" We can use the words "cool" to see that unique is a positive connotation! For the word cool can usually mean that something is real nice or it's something/someone you'd typically like to be around. So therefore these are just a few examples of the advantages and disadvantages of shortcuts.
Explain the three major Subassembly
of a computer Keyboard
The three major Subassembly of a computer Keyboard are as follows; alphabetical keys, function keys, and the numeric keypad.
What are the three major Subassembly of a computer Keyboard?The keyboard is divided into four components as; alphabetical keys, function keys, cursor keys, and the numeric keypad.
An Keyboard is an input Device used to enter characters and functions into the computer system by pressing buttons.
An Keyboard is a panel of keys that operate a computer or typewriter.
Additional special-purpose keys perform specialized functions.
The mouse is a pointing device used to input data.
The Input devices enable to input data and commands into the computer.
The three major Subassembly of a computer Keyboard are as follows; alphabetical keys, function keys, and the numeric keypad.
Learn more about the keybord here;
https://brainly.com/question/24921064
#SPJ2
Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later
date and also make it available to her colleagues.
What is her best option?
Answer:
Making a custom template.
Answer:
Creating a custom template
Explanation:
Hope that helped.
In case of a suspected data breach, what course of action should a chief information security officer (CISO) take
Answer
1. Assemble his team
2. Find reason for breach
3. Evaluate what was lost
4. Ensure password change
Explanation:
In case of a suspected breach, the Chief information security officer should first of all assemble his incidence response team. This team should have representatives from all areas of the organization.
Then the reason for the breach and how access was gained has to be found out. An evaluation of what has been lost in the breach would be carried out and it's likely impact on the company.
In case credentials were stolen the CISO has to ensure that the employees change passwords. Also he has to notify all the necessary parties about the breach.
The CISO has to ensure that all employees are trained properly on security and they comply to security policies.
An alternative design for a canary mechanism place the NULL value just below the return address. What is the rationale for this design decision
Answer:
This is to prevent attacks using the strcpy() and other methods that would return while copying a null character.
Explanation:
Canary is a mechanism used to monitor and prevent buffer overflow. The alternative canary design that places a null value just before the return address is called the terminator canary.
Though the mechanism prevents string attacks, the drawback of the technique is that the value of the canary is known which makes it easy for attackers to overwrite the canary.
1. Discuss the pros and cons of human-computer interaction technology?
2. Discuss the ACID database properties in details
!
gcoo!!Exykgvyukhhytocfplanationufvhyg:
how would i change this:
" try:
userChoice = input("Would you like to Add or Multipy?(A/M): ")
except:
print("Please enter 'A' or 'M'") "
so it only allows me to put "A" or "M" so that it runs the except part
You wouldnt use a try and except statement. Use a loop.
how do I make my own algorithms
Answer:
Step 1: Determine the goal of the algorithm. ...
Step 2: Access historic and current data. ...
Step 3: Choose the right model(s) ...
Step 4: Fine tuning. ...
Step 5: Visualise your results. ...
Step 6: Running your algorithm continuously.
Fill in this function that takes three parameters, two Strings and an int. 4- // Write some test function calls here! The Strings are the message that should be printed. You should alternate printMessage("Hi", "Karel", 5); between the Strings after each line. The int represents the total number of lines that should be printed. public void printMessage(String lineOne, String lineTwo, in For example, if you were to call 19.
printMessage("Hi", "Karel", 5);
// Start here! 12 the function should produce the following output:
Hi
Karel
Hi
Kare
Answer:
The function in Java is as follows:
public static void printMessage(String lineOne, String lineTwo, int lines){
for(int i = 1;i<=lines;i++){
if(i%2 == 1){
System.out.println(lineOne);
}
else{
System.out.println(lineTwo);
}
}
}
Explanation:
This defines the function
public static void printMessage(String lineOne, String lineTwo, int lines){
This iterates through the number of lines
for(int i = 1;i<=lines;i++){
String lineOne is printed on odd lines i.e. 1,3,5....
if(i%2 == 1){
System.out.println(lineOne);
}
String lineTwo is printed on even lines i.e. 2,4,6....
else{
System.out.println(lineTwo);
}
}
}
To call the function from main, use:
printMessage("Hi", "Karel", 5);