Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Help
#1
Hello, I am trying to solve a puzzle that is written in python. The solution is a set of gps coordinates like "N 38 32.321 W 90 31.312" The statement is a repeating python code. I think the solution is to add a "break" but I don't know how to properly do this in python. Does anyone know how to change the code to print the solution? Here is the code:

s=12

for i in range (33):

   o=i

Clarke=77

import random

e=random.randint (6,8)

Hector=485

laisis_fuscus=77

w=random.randint(1,6)

if e==6:

   e+=32

elif e==8:

   e+=30

else:

   e+=31

p=475

s*=2

Boggs=len("laisis_fuscus")

while not (w==6):

   print(laisis_fuscus)

   w+random.randint(1,6)

print ("Hector")

a=Boggs+Clarke

n=Hector+a

s+=5

if s==o:

   p+=2

else:

   p-=2

n+=Clarke
Reply
#2
can you provide link to the puzzle itself?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Sure thing: https://www.geocaching.com/geocache/GC8F...tl-version

It's a geocache puzzle.
Reply
#4
do you want the solution, or just a hint?
I am geocacher too :-)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
How about a hint? I don't really know how to code in python though. Cool to see another cacher on here. :-)
Reply
#6
Remove lines
while not (w==6):
 
   print(laisis_fuscus)
 
   w+random.randint(1,6)
 
print ("Hector")
All they do is to introduce random element, i.e. the code will continue after that part only if w=6.
Then you need to solve the puzzle
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
Okay, thank you for your help!
Reply
#8
when I say you need to solve the puzzle, I mean you need to make the connection how to use the information in/from the script to get the coordinates (e.g. you may need to print something). You can also solve/reproduce what the script is doing on paper and get the result
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
what's going on? did you solve and find it? :-)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020