#๐ trace table
22 messages ยท Page 1 of 1 (latest)
@pearl tree
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I have no idea about what a trace table is - but would writing/running the code in Python help you get there?
You can more or less translate this code to Python line for line, replacing each line with the Python syntax, and it will work in Python. It won't be terribly Pythonic (this pseudocode is actually harder to understand than Pythonic code would be) but it would workd
Okay I'll try that thank you
Is this essentially like a 'how to python for a X developer' or something? Like where x is c++ or javascript or..?
Or has your teacher just printed this out and said "do this in python"
Oh, it's like this: https://www.101computing.net/wp/wp-content/uploads/trace-table-s.gif
Yeah it's like the trace table there it's just I don't know where to start on the trace table
I've put the code in python and still not had any luck
I've put the code in python and still not had any luck
Has your teacher asked you to do this in python? or another language?
I need to fill out the trace table so it doesn't matter what language
Fair enough, I'm asking because I was wondering about the relevance to python since this is not python syntax.
Start with the while loop
I'm going to assume it's not written in lua (most programming languages are 0 indexed based)
# fun fact: this would only work for a 0 index programming language.
array = (10, 3, 7, 11, 19)
newArray = ()
rev = len(array) - 1
index = 0
iTot = 0
# Hint: Algorithm starts here
while array[index] == array[rev]:
newArray.append(array[index] * array[rev])
index += 1
iTot += 1
nTot = 1
for i in newArray:
nTot *= i
fTot = iTot + nTot
# and ends here
This is how to represent it in python code. Hopefully that helps you solve it.
Thank you so much
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.