Hi. I'm trying to convert my python file into pseudo code but I have no idea of how pseudo code work.

continueAnswer = input("Please enter either continue to carry on with the program or end to stop it: ")
continueAnswer=continueAnswer.upper()
while continueAnswer == 'C':
    while True:
        try:
            print('')
            encodeORdecode = input("Type E for encode or D for decode: ")
            if encodeORdecode != 'e' and encodeORdecode != 'd' and endChoice !='END' and endChoice !='NO':
                raise ValueError
            break
        except ValueError:
            print("Invalid Choice!! Please try again")

    step=int(input("Plese enter a number for what you want the offset to be: "))
    #working
    #encoding
    if encodeORdecode == 'e':
        userInput=input("Please enter the message you want to encode: ")
        userInput = userInput.lower()
        for x in range(0,len(userInput),1):
            encoded = chr(ord(userInput[x])+step)
            print(encoded.upper(), end = '')
        print('')
        continueAnswer = input("Do you want to continue or end the program: ")
        continueAnswer=continueAnswer.upper()
    # decoding

    if encodeORdecode == 'd':
        userInput=input("Please enter the message you want to decode: ")
        userInput = userInput.lower()
        for x in range(0,len(userInput),1):
            encoded = chr(ord(userInput[x])-step)
            print(encoded.upper(), end = '')
        print('')
        continueAnswer = input("Do you want to continue or end the program: ")
        continueAnswer=continueAnswer.upper()
#ending program
while continueAnswer == 'END':
    print('۞۞۞Now ending program. Thanks for using my programs guys۞۞۞')
    break

Pseudo-code doesn't work; that's the whole point of it. It is a higher-level description of a problem without the details that would make it a running program. Pseudo-code isn't a specific language - it is just a description of the program in a way that resembles actual code, but omits the details. There is no specific syntax or rules for pseudo-code, you make it up as you go along.

If you don't mind me asking, why do you need pseudo-code for a program that already exists? Usually one writes the pseudo-code first, and then uses that as the design for the actual program, not the other way around. Did you assignment call for you to lay out a design in pseudo-code, and then write the program? If so, how did you come to skip that step?

import random

print('Hello! What is your name?')
myName = input()
guess = 0
secretnumber = random.randint(1, 100)

while guess != secretnumber:

numGuesses = 1
print('Well, ' + myName + ', I am thinking of a number between 1 and 100.')
while guess != secretnumber :

    if guess > secretnumber:
        print ("The number is less than " +str(guess))
        numGuesses +=1
        guess = int(input("Enter a guess: "))

    else:
        print ("The number is greater than " + str(guess))
        numGuesses += 1
        guess = int(input("Enter a guess: "))

print("Right! The number is " + str(secretnumber))
print("You got it in " + str(numGuesses) + " guesses.")

model = ["hatchback", "saloon", "estate"]

optional_extra = ["luxury seats", "satellite navigation", "parking sensors", "bluetooth", "sound system"]

model_price = [535000, 495000, 625000]

optional_extra_price = [45000, 5500, 10000, 350, 1000]

extras_bought = []

model_bought = ""

model_count = 0

optional_extras_total_price = 0

cost = 0

while_count = 0

print(model)

x = input("Which model do you want to buy? ")

model_bought = x

for i in model:

if x == i:

   break;

else:

    model_count += 1

cost += model_price[model_count]

print(optional_extra)

z = int(input("How many extras do you want to buy? "))

while while_count < z:

y = input("Which extra do you want to get: ")

extras_bought.append(y)

for j in optional_extra:

    optional_extra_count = 0

    if y == j:

        break;

    else:

        optional_extra_count += 1

cost += optional_extra_price[optional_extra_count]

optional_extras_total_price += optional_extra_price[optional_extra_count]

while_count += 1

old_car = input("Do you have an old car to trade in?(y/n) ")

if old_car == "y":

bool = True

while bool == True:

    discount = int(input("How much discount do you want?(10000 to 100000) "))

    if discount >= 10000 and discount <= 100000:

        bool = False

    else:

        print("Please enter a discount value under the range(10000 to 100000): ")

        bool = True

elif old_car == "n":

cost = 0.95 * cost

new_or_old = input("Are you an old or a new customer?(old/new) ")

if new_or_old == "old":

cost = 0.9 * cost

if old_car == "y":

cost -= discount

print("first offer, 1% cashback or optional extras free(1)")

print("EMI over 4 years(2)")

print("EMI with 5% interest over 7 years(3)")

offer = int(input("Which offer do you want to take? "))

temp_cost= 0

temp_cost = 0.01 * cost

if offer == 1:

print("If you take 1% cashback, you will get " + str(temp_cost) + " off and if you want free optional extras, you will get " + str(optional_extras_total_price) + " off")

choice = input("Do you want a 1% discount(1) or optional extras free(2)? ")

if choice == 1:

    cost = 0.99*cost

    print("You bought a " + model_bought + " and you also bought the following extras:")

    print(extras_bought)

    print("The total cost of your purchase is " + str(cost))

elif choice == 2:

    cost -= optional_extras_total_price

    print("You bought a " + model_bought + " and you also bought the following extras:")

    print(extras_bought)

    print("The total cost of your purchase is " + str(cost))

elif offer == 2:

monthly_cost = 0

monthly_cost = cost / 48

print("You bought a " + model_bought + " and you also bought the following extras:")

print(extras_bought)

print("The total cost of your purchase is",str(cost))

print("You will have to pay " + str(monthly_cost) + " monthly")

elif offer == 3:

monthly_cost = 0

monthly_cost = (1.05 * cost) / 84

print("You bought a " + model_bought + " and you also bought the following extras:")

print(extras_bought)

print("The total cost of your purchase is",str(cost))

print("You will have to pay " + str(monthly_cost) + " monthly")

convert into the psudocode

commented: Probably not gonna happen. -3

Problems with your post:

  1. You hijacked/revived a four-year-old thread
  2. You posted undocumented code
  3. You didn't post that code properly
  4. You demanded that someone do your work for you

You are basically acting rude and entitled. Good luck getting help with this.

@Punit_2. Burying your request is a hijack among other problems. Your choices here mean not much may happen since you stumbled out of the gate. Try a new post all your own and show your work, explain what stopped you.

If you need this done by others then put the work up for bid or tell how much you'll pay. Here, it's you doing the work and calling on others to get you out of a rut when you are stuck. That is, no one will do your work for you today.

n=int(input("Enter a Number:"))
if n%2==0:
print("Even No")
else:
print("Odd No.")

commented: nope, don't hijack age old threads. And especially not with nonsense like that. -4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.