Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct pesudo code.
#1
I don't exactly understand Pseudo code, it is one of the requirements in my homework assignments and I am just wondering if this is acceptable pseudo code? My teacher hasn't bother with commenting on it, and I am just wondering. 

Pseudocode:
Feet = “”
Inches = 12
feetInches
 
#user input
Feet = UserInput(“How many feet do you have?”)
Display feet
 
#main program
feetInches = feet * inches
 
#output
display (“there are “ feetInches “inches in “ feet “feet”)
Reply
#2
I think of pseudo code as an outline of what you want to accomplish before writing the actual code.

For example, suppose I want my code to test something, I might write:
if the variables are equal:
    Do this
else if they are not equal:
    Print this
By the way, yours would not work, as you define the variable "Feet", but you use "feet".  Remember in Python, case matters.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
(Mar-23-2017, 02:55 PM)sparkz_alot Wrote: I think of pseudo code as an outline of what you want to accomplish before writing the actual code.

For example, suppose I want my code to test something, I might write:
if the variables are equal:
    Do this
else if they are not equal:
    Print this
By the way, yours would not work, as you define the variable "Feet", but you use "feet".  Remember in Python, case matters.
that I do understand, it's just I use word to type in my pseudo code so it always makes the first letter of the first word of the sentence caps.
Reply
#4
Understood, so let me just say this....never, ever use an editor that adds formatting, unless it's specifically designed for coding, such as Notepad++ for Windows, or Kate for the Linux KDE desktop. Otherwise use a basic text editor such as MS Notepad.  If you look at your other post, you will notice you have the same case error (along with others).  So forget using Word and save yourself some headaches.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#5
(Mar-23-2017, 03:17 PM)sparkz_alot Wrote: Understood, so let me just say this....never, ever use an editor that adds formatting, unless it's specifically designed for coding, such as Notepad++ for Windows, or Kate for the Linux KDE desktop. Otherwise use a basic text editor such as MS Notepad.  If you look at your other post, you will notice you have the same case error (along with others).  So forget using Word and save yourself some headaches.

I concur... I've see a whole team of people spending two days trying to understand why a server would not start. It was a non-breaking space in a configuration item, that was copied/pasted from a Word document.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Please check whether the code about the for loop question is correct. (SyntaxError) lilliancsk01 10 2,560 Nov-08-2022, 01:25 PM
Last Post: deanhystad
  Is that code correct? Sameh 7 2,965 May-22-2021, 04:29 PM
Last Post: Sameh
  Syntax error for code that seems correct mcnhscc39 4 3,591 Nov-15-2018, 08:40 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

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