Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Tic-Tac-Toe game


Abhinav and Anjali are playing the Tic-Tac-Toe game. Tic-Tac-Toe is a game played on a grid that's three squares by three squares. Abhinav is O, and Anjali is X. Players take turns putting their marks in empty squares. The first player to get 3 of her marks in a diagonal or horizontal, or vertical row is the winner. When all nine squares are complete, the game is over. If no player has three marks in a row, the game ends in a tie. Write a program to decide the winner in the Tic-Tac-Toe game.


Input


The input will be three lines contain O's and X's separated by space.


Output


The output should be a single line containing either "Abhinav Wins" or "Anjali Wins" or "Tie".


Explanation


For example, if the input is

O X O
O X X
O O X 

as three of O's are in vertical row print "Abhinav Wins".


Sample Input 1

O X O

O X X

O O X


Sample Output 1

Abhinav Wins


Sample Input 2

O O X

X X O

X O O


Sample Output 2


Anti-Diagonals


Given a MxN matrix,write a program to print all Anti-Diagonals elements of matrix


Input

The first line of input will contain a M, N values separated by space.

The second line will contain matrix A of dimensions MxN.


Output

The output should contain anti-diagonal elements separated by a line.




Create a python program using Loops (while or for loop) and if condition that will display 5 different kinds of fruits with price) and ask the user what to order( O- to take order)(N to terminate loop and display all the users order/s including the total price) . The program will request the user to input amount of money for the payment (do some validation) and lastly it will display the change if any.


Anti-Diagonals

Given a MxN matrix,write a program to print all Anti-Diagonals elements of matrix

Input

The first line of input will contain a M, N values separated by space.

The second line will contain matrix A of dimensions MxN.

Output

The output should contain anti-diagonal elements separated by a line.

Explanation

For example, if M = 2, N = 3

Matrix A:

1 5 5

2 7 8

Output:

1

5 2

5 7

8


Requirements: Python

The task is to build the simple function to calculate the metric into temperature conversion inscribed.

in a celsius with the fahrenheit

Design:

The solution to this task is simple: the metric into temperature inscribed

in a metric e with the certain temperature a is equal to -115.15ºC. However degrees Fahrenheit is not a native python variable. We can find degrees Fahrenheit in math module that we need to import in advance.

The desired function will return the degrees Fahrenheit value to the user
  1. Each paycheck, he contributes a specific percentage of hisgross pay to his retirement plan at work. His employer also contributes to hisretirement plan, but at a different rate. Carlos wants a program that will calculate anddisplay the total annual contribution made to his retirement plan by him and his employer. Complete an IPO chart for this problem. Desk-check the algorithm using $1465as the gross pay, 4% as Carlos’s contribution rate, and 2% as his employer’scontribution rate. Then desk-check it using your own set of data.

Compute the 8-point DFT of a sequence x(n) = {1/a, 1/b, 1/c, 1/d, 0, 0, 0, 0} using radix-2 

DIT FFT


Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.


Describe each possibility in your own words.


Define "precondition" and "postcondition" as part of your description.


Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.


Word Count - 2

Given a sentence S, write a program to print the frequency of each word in S, where words are sorted in alphabetical order.


Input


The input will be a single line containing a string S.


Output


The output contains multiple lines, with each line containing a word and frequency of each word in the given string separated by ": ", where words are sorted in alphabetical order.


Explanation


For example, if the given sentence is "Hello world, welcome to python world", the output should be

Hello: 1

python: 1

to: 1

welcome: 1

world: 2


The "signature" of a function is the first line which gives the return type, the name of the function and the parameters with their types. As an example the signature of the gcd function is


int gcd(int m, int n)


Write a function with the following signature


bool is_power_of_two(int n)


It should return true if the n is a power of 2. Otherwise, it should return false. As an example, for n = 28, the function should return false while for n = 32, it should return true.



LATEST TUTORIALS
APPROVED BY CLIENTS