この疑似コードを Python に変換しようとしています。これを行う方法がわかりません。簡単そうに見えますが、私は Python の知識がないので、ほとんど実行できません。これは擬似コードです:
Main Module
Declare Option
Declare value
Declare cost
While(choice ==’Y’)
Write “Vehicle Shipping Rates to Africa”
Write “1. Car to Ghana”
Write “2. Van to Nigeria”
Write “3. Truck to Togo”
Write “4. Van to Kenya”
Write “5. Truck to Somalia”
Write “Enter the choice:”
Get option
Write “Enter the car price:”
Get value
if ( option = 1)
cost = value / 0.30;
write “It would cost $”+cost "to ship a car that cost $” +value+" to Ghana."
else if (option = 2)
cost = value / 0.20;
write “It would cost $”+cost "to ship a car that cost $” +value+" to Nigeria."
else if ( option = 3)
cost = value / 0.33;
write “It would cost $”+cost "to ship a car that cost $” +value+" to Togo."
else if (option = 4)
cost = value / 0.17;
write “It would cost $”+cost "to ship a car that cost $” +value+" to Kenya."
else if ( option = 5)
cost = value / 0.31;
write “It would cost $”+cost "to ship a car that cost $” +value+" to Somalia."
else
write “This is not a valid selection” “Please try again.”
endif
Write “Vehicle price you entered:”, value
Write “Shipping cost:”, cost
Write “Would you like to choose another selection, Y=Yes or N=No.”
Get choice
End while
Write “Thank you our application.”
End main module