Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    5
    ReputationRep:
    Hi

    I am looking online of how to write a pseudocode and apparently it's meant to be straightforward, but clearly I'm not finding it. I've got my coding and am wondering if anyone can help with anything that can lead me to get my pseudocode result.
    It can be anything from what I have to include or not include etc. Or maybe a clear example of your own. If anyone is willing to look at my coding and help with doing a pseudocode that will be great!

    Thanks
    Offline

    3
    ReputationRep:
    If you upload your work we can help (as long as its not breaking any rules)
    Offline

    12
    ReputationRep:
    Pseudo:
    "adjective
    1. not actually but having the appearance of; pretended; false or spurious; sham.
    2. almost, approaching, or trying to be."

    Pseudocode can look like whatever you want it to look like, it just needs to make sense and convey the ideas to another person. It's basically what people use to create a template and brainstorm ideas before actually coding something. It's not something that's going to run if compiled.
    Your lecturer may have a preference for writing it in a certain way so you'd need to ask if that's the case.

    It's not a real language or syntax but you just need to be consistent in how you write it.

    Click the play button for the video to play: https://www.khanacademy.org/computin...th-pseudo-code

    https://www.youtube.com/watch?v=lbWxstGMGuk

    If you want to go from algorithm to pseudocode to code: https://www.youtube.com/watch?v=Q13YfIFSGmk
    Offline

    4
    ReputationRep:
    It just has to make sense but it shouldn't be code
    Eg. in visual studio you'd write: FirstName= InputBox("Enter a name")
    For pseudocode it'd be just : TAKE in FirstNameFROMKEYBOARD
    Offline

    11
    ReputationRep:
    Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense.

    Here's an example of pseudo code:


    START

    --- INPUT number (integer value);

    --- IF number is less than 0:
    ------ PRINT (number + "is less than zero";
    --- ELSE number is more than 0:
    ------ PRINT (number + "is more than zero";

    END
    Replace the emoticons with ). The dashes are indentations because I can't indent here for some odd reason.
    • Thread Starter
    Offline

    5
    ReputationRep:
    Ok thanks for your help guys. Kind of makes sense. Basically, whatever the coding is about to do and means, I put it in simple language right. I also change my variable names too.

    This is one of my code lines, it may not make sense to you as its coursework, but can someone help to put it how you would:

    gtin8_number_string= '1235789'
    barcode_number_string = int(1+3+7+9)*3 + int(2+5+8)*1
    print (barcode_number_string)

    Thank You
    • Thread Starter
    Offline

    5
    ReputationRep:
    "Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense."

    Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?

    Thanks
    Offline

    12
    ReputationRep:
    (Original post by jackymang12345)
    "Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense."Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?Thanks
    A simple example of pseudocode:

    Pseudocode:
    Code:
    PRINT "Printing..." 10 times
    Real code:
    Code:
    for (i = 0; i < 10; i++);
    {
    Console.WriteLine("Printing...");
    }
    From your code it looks like you could write it along the lines of:
    Code:
    Set variable gtin8_number_string to '1235789'
    
    Add integers 1, 3, 7, 9 together then multiply by 3
    Add integers 2, 5, 8 together then multiply by 1
    Add final result of previous two lines together then save in variable barcode_number_string
    
    Print barcode_number_string
    I'd just like to add that you're saving the values from int(1+3+7+9)*3 + int(2+5+8)*1 in a variable that's called barcode_number_string but I think these would probably be saved as integers (just check). You might need to change them into a string afterwards if that's the case (using ' or " ) if the barcode_number_string needs to actually be a string.
    If you need help with that let me know.

    You might want to use double quotes ( " ) instead of single quotes ( ' ) by the way when using strings, this is much better practice, because ' implies char not string, at least to me There doesn't seem to be much difference in python but google to check.
    • Thread Starter
    Offline

    5
    ReputationRep:
    Oh wow! Thank You so much. Out of everything this really helped me understand how to do it. I guess it's seeing my own coursework in Pseudocode that helped me get it rather than loads of others. If I get stuck later, do you have an email I can message you on or on this page is fine.

    Thank You it really helped
    Offline

    11
    ReputationRep:
    (Original post by jackymang12345)
    Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?

    Thanks
    You do the pseudo code before you write actual code. Pseudo code is in the design and planning stage. You do not design and plan after. If you are asking me to convert the pseudo code into compilable code then here it is:


    number = input("Enter a number."
    number = int(number);

    if number < 0:
    --- print (number);
    --- print ("number is less than 0.";
    else:
    --- print (number);
    --- print ("number is more than 0.";
    I realised my programming skill is very rusty.

    ---

    I'm in year 10 and I'm confused. I'm going to presume you are in year 10 too. Why aren't you doing the same coursework as me?

    ---

    (Original post by catinsomehat)
    You might want to use double quotes ( " ) instead of single quotes ( ' ) by the way when using strings, this is much better practice, because ' implies char not string, at least to me
    What's the difference between char and string? And, how did you write your code like that?
    • Thread Starter
    Offline

    5
    ReputationRep:
    "You do the pseudo code before you write actual code. Pseudo code is in the design and planning stage. You do not design and plan after. If you are asking me to convert the pseudo code into compilable code then here it is:"



    I know but I don't know why we got told and are doing after?! What coursework are you doing btw?
    Offline

    11
    ReputationRep:
    (Original post by jackymang12345)
    I know but I don't know why we got told and are doing after?! What coursework are you doing btw?
    I blame lazy teachers not covering everything that needs to be covered before going into the coursework.

    I am doing text compression. How about you?
    • Thread Starter
    Offline

    5
    ReputationRep:
    Exactly! Not helpful at all! I have to do it over these summer holidays and with no teacher its really hard.

    I'm doing something totally different in Python!
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Would you like to hibernate through the winter months?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.