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
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.