How do i make it so that it goes back up to run the correct IF if it prints out any of the “p”sHow to flush output of print function?How to print without newline or space?How can I make a time delay in Python?How to make a chain of function decorators?How to make a flat list out of list of lists?How do I check what version of Python is running my script?How to put the legend out of the plotHow to make a Python script standalone executable to run without ANY dependency?How can I print literal curly-brace characters in python string and also use .format on it?How to print to stderr in Python?
is this a spam?
Coordinate position not precise
Understanding "audieritis" in Psalm 94
Trouble understanding overseas colleagues
How to be diplomatic in refusing to write code that breaches the privacy of our users
Are there any comparative studies done between Ashtavakra Gita and Buddhim?
Can a monster with multiattack use this ability if they are missing a limb?
Everything Bob says is false. How does he get people to trust him?
Can I use my Chinese passport to enter China after I acquired another citizenship?
Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads
Implement the Thanos sorting algorithm
Greatest common substring
Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past
Hide Select Output from T-SQL
Why does John Bercow say “unlock” after reading out the results of a vote?
Was the picture area of a CRT a parallelogram (instead of a true rectangle)?
Displaying the order of the columns of a table
Can somebody explain Brexit in a few child-proof sentences?
Why are on-board computers allowed to change controls without notifying the pilots?
What is the intuitive meaning of having a linear relationship between the logs of two variables?
Efficiently merge handle parallel feature branches in SFDX
Teaching indefinite integrals that require special-casing
If you attempt to grapple an opponent that you are hidden from, do they roll at disadvantage?
What's the purpose of "true" in bash "if sudo true; then"
How do i make it so that it goes back up to run the correct IF if it prints out any of the “p”s
How to flush output of print function?How to print without newline or space?How can I make a time delay in Python?How to make a chain of function decorators?How to make a flat list out of list of lists?How do I check what version of Python is running my script?How to put the legend out of the plotHow to make a Python script standalone executable to run without ANY dependency?How can I print literal curly-brace characters in python string and also use .format on it?How to print to stderr in Python?
In the Exploration problem, a robot is placed at the center of an 11 meter long line. Each “second”, the robot takes a 1 meter step either Left or Right at random.
a) Write a program to determine how long the robot will walk before reaching either end of the line. Have the program average Nth trials, and report the average and longest time. Final presentation of your result after Nth trials is expected to be part of your program, properly formatted.
b) Your program to show the position of the robot after each step:
c) Determine if there is any relationship between which end of the line the robot reaches and the
length of the walk. “Your Robot has a tendency to go to the with an average of ”. Print the average and longest walks for each end of the line.
from random import*
p0 = ('-*| |')
p1 = ('--|* |')
p2 = ('--| * |')
p3 = ('--| * |')
p4 = ('--| * |')
p5 = ('--| * |')
p6 = ('--| * |')
p7 = ('--| * |')
p8 = ('--| * |')
p9 = ('--| *|')
p10 = ('--| |*')
trials = int(input("How many trials do you want the Robot to take?:"))
steps = 0
print (steps, "", p5)
x = 5
stepsavrg = (steps / trials)
numlist = [1, 2]
while trials >= 0:
while x == 1:
leftright4 = sample (numlist, 1)
if leftright4 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
while x == 2:
leftright3 = sample (numlist, 1)
if leftright3 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p1)
else:
print(steps, "", p1)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
while x == 3:
leftright2 = sample (numlist, 1)
if leftright2 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
while x == 4:
leftright1 = sample (numlist, 1)
if leftright1 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
else:
steps += 1
x = x + 1
if steps >= 9:
print(steps, p5)
else:
print(steps, "", p5)
while x == 5:
leftright9 = sample (numlist, 1)
if leftright9 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
while x == 6:
leftright8 = sample (numlist, 1)
if leftright8 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p5)
else:
print(steps, "", p5)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
while x == 7:
leftright7 = sample (numlist, 1)
if leftright7 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
while x == 8:
leftright6 = sample (numlist, 1)
if leftright6 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p9)
else:
print(steps, "", p9)
while x == 9:
leftright5 = sample (numlist, 1)
if leftright5 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
python
New contributor
|
show 16 more comments
In the Exploration problem, a robot is placed at the center of an 11 meter long line. Each “second”, the robot takes a 1 meter step either Left or Right at random.
a) Write a program to determine how long the robot will walk before reaching either end of the line. Have the program average Nth trials, and report the average and longest time. Final presentation of your result after Nth trials is expected to be part of your program, properly formatted.
b) Your program to show the position of the robot after each step:
c) Determine if there is any relationship between which end of the line the robot reaches and the
length of the walk. “Your Robot has a tendency to go to the with an average of ”. Print the average and longest walks for each end of the line.
from random import*
p0 = ('-*| |')
p1 = ('--|* |')
p2 = ('--| * |')
p3 = ('--| * |')
p4 = ('--| * |')
p5 = ('--| * |')
p6 = ('--| * |')
p7 = ('--| * |')
p8 = ('--| * |')
p9 = ('--| *|')
p10 = ('--| |*')
trials = int(input("How many trials do you want the Robot to take?:"))
steps = 0
print (steps, "", p5)
x = 5
stepsavrg = (steps / trials)
numlist = [1, 2]
while trials >= 0:
while x == 1:
leftright4 = sample (numlist, 1)
if leftright4 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
while x == 2:
leftright3 = sample (numlist, 1)
if leftright3 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p1)
else:
print(steps, "", p1)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
while x == 3:
leftright2 = sample (numlist, 1)
if leftright2 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
while x == 4:
leftright1 = sample (numlist, 1)
if leftright1 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
else:
steps += 1
x = x + 1
if steps >= 9:
print(steps, p5)
else:
print(steps, "", p5)
while x == 5:
leftright9 = sample (numlist, 1)
if leftright9 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
while x == 6:
leftright8 = sample (numlist, 1)
if leftright8 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p5)
else:
print(steps, "", p5)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
while x == 7:
leftright7 = sample (numlist, 1)
if leftright7 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
while x == 8:
leftright6 = sample (numlist, 1)
if leftright6 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p9)
else:
print(steps, "", p9)
while x == 9:
leftright5 = sample (numlist, 1)
if leftright5 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
python
New contributor
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
1
You can dosteps += 1
instead ofsteps = steps + 1
– Bailey Parker
Mar 21 at 15:17
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11
|
show 16 more comments
In the Exploration problem, a robot is placed at the center of an 11 meter long line. Each “second”, the robot takes a 1 meter step either Left or Right at random.
a) Write a program to determine how long the robot will walk before reaching either end of the line. Have the program average Nth trials, and report the average and longest time. Final presentation of your result after Nth trials is expected to be part of your program, properly formatted.
b) Your program to show the position of the robot after each step:
c) Determine if there is any relationship between which end of the line the robot reaches and the
length of the walk. “Your Robot has a tendency to go to the with an average of ”. Print the average and longest walks for each end of the line.
from random import*
p0 = ('-*| |')
p1 = ('--|* |')
p2 = ('--| * |')
p3 = ('--| * |')
p4 = ('--| * |')
p5 = ('--| * |')
p6 = ('--| * |')
p7 = ('--| * |')
p8 = ('--| * |')
p9 = ('--| *|')
p10 = ('--| |*')
trials = int(input("How many trials do you want the Robot to take?:"))
steps = 0
print (steps, "", p5)
x = 5
stepsavrg = (steps / trials)
numlist = [1, 2]
while trials >= 0:
while x == 1:
leftright4 = sample (numlist, 1)
if leftright4 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
while x == 2:
leftright3 = sample (numlist, 1)
if leftright3 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p1)
else:
print(steps, "", p1)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
while x == 3:
leftright2 = sample (numlist, 1)
if leftright2 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
while x == 4:
leftright1 = sample (numlist, 1)
if leftright1 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
else:
steps += 1
x = x + 1
if steps >= 9:
print(steps, p5)
else:
print(steps, "", p5)
while x == 5:
leftright9 = sample (numlist, 1)
if leftright9 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
while x == 6:
leftright8 = sample (numlist, 1)
if leftright8 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p5)
else:
print(steps, "", p5)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
while x == 7:
leftright7 = sample (numlist, 1)
if leftright7 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
while x == 8:
leftright6 = sample (numlist, 1)
if leftright6 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p9)
else:
print(steps, "", p9)
while x == 9:
leftright5 = sample (numlist, 1)
if leftright5 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
python
New contributor
In the Exploration problem, a robot is placed at the center of an 11 meter long line. Each “second”, the robot takes a 1 meter step either Left or Right at random.
a) Write a program to determine how long the robot will walk before reaching either end of the line. Have the program average Nth trials, and report the average and longest time. Final presentation of your result after Nth trials is expected to be part of your program, properly formatted.
b) Your program to show the position of the robot after each step:
c) Determine if there is any relationship between which end of the line the robot reaches and the
length of the walk. “Your Robot has a tendency to go to the with an average of ”. Print the average and longest walks for each end of the line.
from random import*
p0 = ('-*| |')
p1 = ('--|* |')
p2 = ('--| * |')
p3 = ('--| * |')
p4 = ('--| * |')
p5 = ('--| * |')
p6 = ('--| * |')
p7 = ('--| * |')
p8 = ('--| * |')
p9 = ('--| *|')
p10 = ('--| |*')
trials = int(input("How many trials do you want the Robot to take?:"))
steps = 0
print (steps, "", p5)
x = 5
stepsavrg = (steps / trials)
numlist = [1, 2]
while trials >= 0:
while x == 1:
leftright4 = sample (numlist, 1)
if leftright4 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p0)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
while x == 2:
leftright3 = sample (numlist, 1)
if leftright3 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p1)
else:
print(steps, "", p1)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
while x == 3:
leftright2 = sample (numlist, 1)
if leftright2 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p2)
else:
print(steps, "", p2)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
while x == 4:
leftright1 = sample (numlist, 1)
if leftright1 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p3)
else:
print(steps, "", p3)
else:
steps += 1
x = x + 1
if steps >= 9:
print(steps, p5)
else:
print(steps, "", p5)
while x == 5:
leftright9 = sample (numlist, 1)
if leftright9 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p4)
else:
print(steps, "", p4)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
while x == 6:
leftright8 = sample (numlist, 1)
if leftright8 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p5)
else:
print(steps, "", p5)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
while x == 7:
leftright7 = sample (numlist, 1)
if leftright7 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p6)
else:
print(steps, "", p6)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
while x == 8:
leftright6 = sample (numlist, 1)
if leftright6 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p7)
else:
print(steps, "", p7)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p9)
else:
print(steps, "", p9)
while x == 9:
leftright5 = sample (numlist, 1)
if leftright5 == [1]:
steps += 1
x = x - 1
if steps >= 10:
print(steps, p8)
else:
print(steps, "", p8)
else:
steps += 1
x = x + 1
if steps >= 10:
print(steps, p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
else:
print(steps, "", p10)
print("The robot took %.0f steps to step over the track." %(steps))
print("Trial over.")
if trials == 1:
print("Your robot took an average of %.0f steps in %.0f trial." %(steps, trials))
else:
print("Your robot took an average of %.0f steps in %.0f trials." %(steps, trials))
trials = -1
python
python
New contributor
New contributor
edited Mar 22 at 12:49
Cedi Ilacas
New contributor
asked Mar 21 at 15:04
Cedi IlacasCedi Ilacas
12
12
New contributor
New contributor
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
1
You can dosteps += 1
instead ofsteps = steps + 1
– Bailey Parker
Mar 21 at 15:17
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11
|
show 16 more comments
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
1
You can dosteps += 1
instead ofsteps = steps + 1
– Bailey Parker
Mar 21 at 15:17
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
1
1
You can do
steps += 1
instead of steps = steps + 1
– Bailey Parker
Mar 21 at 15:17
You can do
steps += 1
instead of steps = steps + 1
– Bailey Parker
Mar 21 at 15:17
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11
|
show 16 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Cedi Ilacas is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283483%2fhow-do-i-make-it-so-that-it-goes-back-up-to-run-the-correct-if-if-it-prints-out%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Cedi Ilacas is a new contributor. Be nice, and check out our Code of Conduct.
Cedi Ilacas is a new contributor. Be nice, and check out our Code of Conduct.
Cedi Ilacas is a new contributor. Be nice, and check out our Code of Conduct.
Cedi Ilacas is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283483%2fhow-do-i-make-it-so-that-it-goes-back-up-to-run-the-correct-if-if-it-prints-out%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sorry could you reformulate the question/explanation please? it's a bit confusing; olus could you put an example of what you need to archive!
– Carlo 1585
Mar 21 at 15:09
Theres most certainly a better way to do what you're doing so far. (Think: is there a better structure to represent a track of fixed length that allows a robot to take a slot in one of the spots on the track?) However, talking about the question itself, i am afraid it is still not very clear. Could you elaborate on what are you trying, and what specifically is the problem with it? Also, could you add an expected/desired output for some input?
– Paritosh Singh
Mar 21 at 15:09
1
You can do
steps += 1
instead ofsteps = steps + 1
– Bailey Parker
Mar 21 at 15:17
This program has the user enter the number of trials they want to do and then after the trials it calculates how many steps it took and also the avarage steps it took of the whole thing
– Cedi Ilacas
Mar 21 at 16:08
@ParitoshSingh i need something to make it step only once and it keeps going until it steps off the track
– Cedi Ilacas
Mar 21 at 16:11