Шукаєте відповіді та рішення тестів для 📚 Computer Programming - LIIEEng02ECompProg? Перегляньте нашу велику колекцію перевірених відповідей для 📚 Computer Programming - LIIEEng02ECompProg в moodle.ecam.fr.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
Calculate the following binary sum:
01101 + 00111 =
Give your answer with 5 bits.
Convert the binary number 1110011 in decimal.
Calculate the following binary sum:
101101 + 100111 =
Give your answer with 7 bits.
In this exercise, we have a python script of Langton's ant that uses a 50 by 50 grid. This grid is saved in a list of lists containing a 0 for each black cell and a 1 for each white cell. This list of list is a variable called grid.
There is a button on the window meant to load a predefined grid.
The only missing thing is the coding of the "load" button. We want this button to read an existing text file named "grid_save.txt"containing the state of the grid as text.
For example, if the text file contains:0101110100101110We want the grid to be updated as:[[0, 1, 0, 1], [1, 1, 0, 1], [0, 0, 1, 0], [1, 1, 1, 0]]
Here is the part of the code where the loading of the grid should be implemented:
new_file = open("grid_save.txt", "r")
if load == True:
x = 0
y = 0
for line in new_file:
line = line.strip(???)
y = y + 1
for character in line:
grid[y][x] = ???
x = x + 1
new_file.close()
Write the 2 missing pieces of code represented by ???. Seperate both line with a semi-colon ";".
In this exercise, we have a python script of Langton's ant that uses a 50 by 50 grid. This grid is saved in a list of lists containing a 0 for each black cell and a 1 for each white cell. This list of list is a variable called grid.
There is a button on the window used to pause the simulation and another button meant to save the current grid.
The only missing thing is the coding of the "save" button. We want this button to create a text file named "grid_save.txt" and inside we want to write the content of the grid variable.
For example, if the grid contains:[[0, 1, 0, 1], [1, 1, 0, 1], [0, 0, 1, 0], [1, 1, 1, 0]]We want the text file to contain:0101110100101110
Here is the part of the code where the saving of the grid should be implemented:
new_file = open("grid_save.txt", "w")
file_text = ""
if saved == True:
for x in range(50):
for y in range(50):
cell = grid[y][x]
???
???
new_file.write(file_text)
new_file.close()
Write the 2 missing lines of code represented by ???. Seperate both line with a semi-colon ";".
Convert the decimal number 39 into a binary number.
Write your answer with 6 bits.
For each of the following data structure, give the corresponding python type.
Here is a flowchart of Langton's ant simulation, it concernes the part where the code handles the event done by the user.There are 3 buttons the user can press during the simulation, pause, reset, quit.Which of the following statements are true?
Here is a very simplified version of Langton's ant flowchart, which of the following statements are True?