Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Python to Pseudo-Code

Hey,
I have made a simple game in Python (only 8 lines), however, I am struggling to convert it into Pseudo-Code. Can someone check this or write it correctly please?

Python Code
Spoiler (Click to View)

Pseudo-Code (Needs fixing?)
Spoiler (Click to View)
Does pseudo code even have a specific syntax one needs to follow? I've always just written losely what my thoughts were, even if that meant mixing python/java/other-language together
[Image: TEGE4Zx.png]

Puzzle level: 2/5
(Sep 9, 2017 04:02 AM)nOrr Wrote:  Does pseudo code even have a specific syntax one needs to follow? I've always just written losely what my thoughts were, even if that meant mixing python/java/other-language together

yeah pseudo-code doesn't have a specific syntax, i just need my algorithm to be checked
(Sep 9, 2017 04:05 AM)Obscurus Wrote:  yeah pseudo-code doesn't have a specific syntax, i just need my algorithm to be checked

I would be more worried about the code.

Code
x = "A1"  
while True:  
  z = str(input("Enter location from A1 to C3:"))  
  if z == x:  
    print("You found the treasure!")
  else:  
       print("You did not find the treasure! Try again!")  
    break

in is more for checking if something is in something not if sometimes equals something.

PHP Code

<?php 
my_string 
= 'This is my string'
print('my' in my_string)

my_list = ['1', '2', '3','4']
print(
5 in my_list) 

¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
(Sep 9, 2017 04:20 AM)vorticalbox Wrote:  I would be more worried about the code.
[...]
in is more for checking if something is in something not if sometimes equals something.

PHP Code

<?php 
my_string 
= 'This is my string'
print('my' in my_string)

my_list = ['1', '2', '3','4']
print(
5 in my_list) 

Why would you write 'abc' in 'abc'?
[Image: TEGE4Zx.png]

Puzzle level: 2/5
(Sep 9, 2017 04:24 AM)nOrr Wrote:  Why would you write 'abc' in 'abc'?

I wouldn't, OP did for the check.

¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
(Sep 9, 2017 04:20 AM)vorticalbox Wrote:  I would be more worried about the code.

Code
x = "A1"  
while True:  
  z = str(input("Enter location from A1 to C3:"))  
  if z == x:  
    print("You found the treasure!")
  else:  
       print("You did not find the treasure! Try again!")  
    break

in is more for checking if something is in something not if sometimes equals something.

PHP Code

<?php 
my_string 
= 'This is my string'
print('my' in my_string)

my_list = ['1', '2', '3','4']
print(
5 in my_list) 

Updated Code:

Code
x = "A1"    
while True:  
  z = str(input("Enter location from A1 to C3:"))  
  if z == x:    
    print("You found the treasure!")  
    break
  else:  
    print("You did not find the treasure! Try again!")

Better?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[C#] by WeedIsInTheAirSep 24, 2022 04:15 PM 0 177 Sep 24, 2022 04:15 PM
Last Post: WeedIsInTheAir
[Python] by mikehackMay 9, 2022 11:12 AM 2 151 May 9, 2022 11:12 AM
Last Post: mikehack