Question

Write a python program that generates a sudoku puzzle.1. Enter n (which is the size of the sudoku puzzle #2. Keep generating random permutations of n using python built in function until you find permutation that can be incorporated as a new component of the sudoku grid.

format for puzzle should be output 1 2 3

3 1 2

2 3 1

Answer #1

x = int(input())

e,f = x,x

def RandomList(st,ed,nom):

tp = []

temp = random.randint(st, ed)

for x in range(nom):

while temp in tp:

temp = random.randint(st, ed)

tp.append(temp)

return tp

lis = RandomList(1,x,x)

sudoku = []

for i in range(len(lis)):

sudoku.append(lis[i:] + lis[:i])

for s in range(x):

for d in range(0,e,f):

for si in range(s,e,f):

for li in range(d,d+f):

print(sudoku[si][li],end = ' ')

print()

IN PYTHON : Write a program that asks the user for a number.
Write the number to a file called total.txt. Then ask the user for
a second number. Write the new number on line 2 with the total for
both numbers next to it separated by a comma. Then ask the user for
a third number and do the same. Keep asking for numbers until the
person puts in a zero to terminate the program. Close the file. Be...

Python: Write a program that makes sum of 1, 2, 3, … until the
sum is over 1000.

Write a Python program that plays a number guessing game with a
human user. The human user will think of a number between 1 and
100, inclusive. Then the program has to guess what the user
entered. keep track of the number of interaction it takes for the
computer to guess the number.
sample run:
enter number to be guessed:88
output: you entered 88, and it took the program 3 iterations to
guess.

Write a python code that will ask the user to enter an integer
number n. Construct a recursive function that
prints numbers 1 to n in the form “11223344..nn”.

Please use Python 3
4). Write a program that asks the user to enter 10 numbers. The
program should store the numbers in a list and then display the
following data:
• The lowest number in the list •
The highest number in the list
•The total of the numbers in the list
• The average of the numbers in the list
Sample input & output:
(Prompt) Enter Number 1: (User enter) 4
(Prompt) Enter Number 2: (User enter) 7...

Python Question:
Write a function which returns the sum of squares of the
integers 1 to n. For example, the sum of the squares from 1 to 4 is
1 + 4 + 9 + 16, or 30. You may choose what should be returned if n
== 0
You may not use the built-in Python sum function.
The Solution Must be recursive
>>> sum_of_squares(1)
1
>>> sum_of_squares(4)
30
>>> sum_of_squares(8) # 64 + 49 + 36 + ... +...

Write a Python program that reads in the month, day, and year
of a date and prints it in the
dd/mm/yyyy format or mm/dd/yyyy format, the format depending
on the user’s preference. The
program also prints the message
It is a magic date
If the product of month and day is equal to the last two
digits of the year. For example, April 20
1980 is a magic date because April (numeric value 4)
multiplied by 20 is equal to...

TO BE DONE IN PYTHON: Write a function `lowest_integer()` which
takes 2 input arguments:
1)a function `g` representing an increasing function
g(x)
2) a number `gmin`,
and returns an integer `nmin` such that
nmin>0
is the smallest integer that satisfies
g(nmin)>gmin.
test:
def g(n):
return 2*n
print(lowest_integer(g, 10))
Output: 6

using C++
1) write a program to calculate to avg of N number of
subjects.
2)write a program to find the factorial of 5!
5*4*3*2*1
3)write a program to display the multiplication table for any
number
please enter number : 3
1*3=3
2*3=6
2*4=
10*3=30
4) find the factorial on n

WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question,
DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER
QUESTION:
1) Fibonacci sequence is a sequence in which every number after
the first two is the sum of the two preceding ones. Write a C++
program that takes a number n from user and populate an array with
first n Fibonacci numbers.
For example:
For n=10
Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
2):
Write...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 3 minutes ago

asked 13 minutes ago

asked 18 minutes ago

asked 18 minutes ago

asked 26 minutes ago

asked 47 minutes ago

asked 51 minutes ago

asked 57 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago