1. Engineering
  2. Computer Science
  3. when i write choose 3 numbers as command i want...

Question: when i write choose 3 numbers as command i want...

Question details

When I write CHOOSE 3 NUMBERS as command, I want determine n=3 with this code. So I want to choose the number between two spaces, for value of n. How should I modify this code in PYTHON? It can't run properly. I have to specifically use modification of this code.
The code is:

command=input("write command")
if "NUMBERS" in command:
command=list(command)
i=0
command_line=command[i]
count_space = 0
start_index = 0
end_index = 0
j = 0
while(count_space!=2):
if (command_line[j]==" "):
count_space = count_space + 1
if (count_space == 1):
start_index = j+1
if (count_space == 2):
end_index = j
j = j + 1
n = command_line[start_index:end_index]
n=int(n)
numbers(number_dict,n)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution