Sylvia's Very Clever PYTHON Solution
Posted: Mon Jul 11, 2022 11:31 pm
So in programming class we are starting to meld our tidbits into more complex programs, especially those that we already once made in Scratch. Of course, the geometry that one can play with making some very cool abstract patterns in Python Turtle is another of BOTh Melissa and Sylvia's impressive abilities... I really think somethig with their ALGORITHMIC ART event could combine Python...
But on our route to re-do our Caesar Cipher in Python (which they had done in Scratch already) is to make a simple "string inversion" cipher.
A perfect vehicle to start exploring the while loop (since we have really only seen the for loop up until now).
Here is the official code:
And then Sylvia sent me:
Haha dang. Sure my point was to teach the while loop but this is definitely a programmer's reply to a teacher! Three lines, three steps. Mine has more lines and of coruse the longer the message the longer it would likely take.
Well done Sylvia, really thinking like a programmer!
But on our route to re-do our Caesar Cipher in Python (which they had done in Scratch already) is to make a simple "string inversion" cipher.
A perfect vehicle to start exploring the while loop (since we have really only seen the for loop up until now).
Here is the official code:
mensaje_original = input("Qué es tu mensaje? ")
descifrado = ""
i = len(mensaje_original) - 1
while i >= 0 :
descifrado = descifrado + mensaje_original
i = i - 1
print(descifrado)
And then Sylvia sent me:
mensaje="python es muy cool"
mensaje_invertido="".join(reversed(mensaje))
print(mensaje_invertido)
Haha dang. Sure my point was to teach the while loop but this is definitely a programmer's reply to a teacher! Three lines, three steps. Mine has more lines and of coruse the longer the message the longer it would likely take.
Well done Sylvia, really thinking like a programmer!