Question

N1 and N2 could be any positive numbers (odd or even) and they could also be...

N1 and N2 could be any positive numbers (odd or even) and they could also be equal. In the case of even, then you will have two middle numbers that should be 0s. Like for example:

N1 = 4 and N2=5 then the pattern should be:
1 1 1 1 1
1 1 0 1 1
1 1 0 1 1
1 1 1 1 1

another example:
N1= 6 and N2=6
1 1 1 1 1 1
1 1 1 1 1 1
1 1 0 0 1 1
1 1 0 0 1 1
1 1 1 1 1 1
1 1 1 1 1 1

Homework Answers

Answer #1

n1=int(input("Enter n1 : "))
n2=int(input("Enter n2 : "))

l1=n1%2
if(n1%2==0):
list1=[int((n1/2-1)),int(n1/2)]
if(n1%2==1):
list1=[int(n1/2)]
if(n2%2==0):
list2=[int(n2/2-1),int(n2/2)]
if(n2%2==1):
list2=[int(n2/2)]

for i in range(n1):
for j in range(n2):
if(i in list1 and j in list2):
print("0 ",end='')
else:
print("1 ",end='')
print()

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
User enters two numbers, N1, and N2. Write a program that determine if the numbers are...
User enters two numbers, N1, and N2. Write a program that determine if the numbers are twin primes. Definition: Twin primes are two prime numbers separated by 2. For example, 3 and 5 are both prime numbers and separated by 2. Another example is 17, 19.
User enters two numbers, N1, and N2. Write a program that determine if the numbers are...
User enters two numbers, N1, and N2. Write a program that determine if the numbers are twin primes. Definition: Twin primes are two prime numbers separated by 2. For example, 3 and 5 are both prime numbers and separated by 2. Another example is 17, 19. matlab
A large collection of​ one-digit random numbers should have about​ 50% odd and​ 50% even digits\...
A large collection of​ one-digit random numbers should have about​ 50% odd and​ 50% even digits\ because five of the ten digits are odd​ (1, 3,​ 5, 7, and​ 9) and five are even​ (0, 2,​ 4, 6, and​ 8).A. .Find the proportion of​ odd-numbered digits in the following lines from a random number table. Count carefully: 9 9 2 8 9 7 6 5 8 3 0 8 6 0 2 3 7 8 4 9 9 2 8...
1. Give a direct proof that the product of two odd integers is odd. 2. Give...
1. Give a direct proof that the product of two odd integers is odd. 2. Give an indirect proof that if 2n 3 + 3n + 4 is odd, then n is odd. 3. Give a proof by contradiction that if 2n 3 + 3n + 4 is odd, then n is odd. Hint: Your proofs for problems 2 and 3 should be different even though your proving the same theorem. 4. Give a counter example to the proposition: Every...
2. Using a “for loop” print all even numbers in rage from 1 to 1000. Also,...
2. Using a “for loop” print all even numbers in rage from 1 to 1000. Also, please count and print how many even numbers you have found. 3. Using the following list and a “for” loop, display differences of all consecutive pairs of numbers in the list. our_list = [1,2,5,6,3,77,9,0,3,23,0.4,-12.4,-3.12] The output should look like this: 1 3 1 … 4. Using a “while loop” ask the user for a number and add it to a list if number is...
***Python Hailstones, also known as the Collatz sequence, are a mathematical curiosity. For any number in...
***Python Hailstones, also known as the Collatz sequence, are a mathematical curiosity. For any number in the sequence, the next number in the sequence is determined by two simple rules: If the current number n is odd, the next number in the sequence is equal to 3 * n + 1 If the current number n is even instead, the next number in the sequence is equal to one half of n (i.e., n divided by 2) We repeat this...
True Or False 1. If nn is odd and the square root of nn is a...
True Or False 1. If nn is odd and the square root of nn is a natural number then the square root of nn is odd. 2. The square of any even integer is even 3. The substraction of 2 rational numbers is rational. 4. If nn is an odd integer, then n2+nn2+n is even. 5. If a divides b and a divides c then a divides bc. 6. For all real numbers a and b, if a^3=b^3 then a=b.
You need to write a program that reads in two integers from cin and outputs a...
You need to write a program that reads in two integers from cin and outputs a horribly inefficient calculation of the median value. First, count from the first number to the second, but stop one short. Then, count from that number back towards the first, again stopping one short. Continue until you reach a single number. Enter: 3 9 Out: 3 4 5 6 7 8 9 9 8 7 6 5 4 4 5 6 7 8 8 7...
by MULTISIM Design a 4 bit Counter that displays even numbers when a switch on, and...
by MULTISIM Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off . i want you to desgin that cirucit in MULTIsim by useing Jk flip flop please make it easy to understand and memories =[ that mean if it was even= 0 its will count 0 , 2 , 4 ,6 , 8 , 10 , 14 if it is odd = 1 its will count 1 , 3 ,...
Proofs For this assignment, know that: An integer is any countable number. Examples are: -3, 0,...
Proofs For this assignment, know that: An integer is any countable number. Examples are: -3, 0, 5, 1337, etc. A rational number is any number that can be written in the form a/b, a and b are integers in lowest terms, and b cannot equal 0. Examples are 27, 22/7, -3921/2, etc. A real number is any number that is not imaginary or infinity. Examples are 0, 4/3, square root of 2, pi, etc. 1. Prove that the product of...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT