Skip to content
EspañolWorkspace →

PSeInt profile FINESI UNAP Estricto

These are the rules of the FINESI UNAP Estricto profile, explained simply, with an example that follows them and opens in Codoritmo with one click.

Open in Codoritmo with this profile

Opens this page's example with the FINESI UNAP Estricto profile already switched on.

How its author describes it

The profile's original text, in Spanish, as distributed with PSeInt.

Curso
Fundamentos de programación - Matematica computacional - Análisis y diseño de algoritomos (Perfil ESTRICTO)
Institución
Facultad de Ingenieria Estadistica e Informatica de la Universidad Nacional del Altiplano - Puno - Peru - Licenciada por SUNEDU
Docente
Ing. Romel P. Melgarejo Bolivar

In short

What changes compared with Codoritmo's default profile:

  • Every variable must be declared with Definir
  • Every variable needs a value before it is used
  • No accents or ñ in variable names
  • Every statement must end with a semicolon
  • Entonces, Hacer and endings such as FinSi must be written in full
  • No conditions like Es Par: comparisons use operators
  • Text can't be joined with +
  • Arrays start at 0
  • Array sizes must be fixed numbers
  • No Para Cada (for each) loop
  • Repetir only ends with Hasta Que
  • Counting down needs Con Paso -1
  • Segun only works with whole numbers

All of its rules

Marked rules differ from Codoritmo's default profile; everything else behaves the same.

Variables

How they are declared and when they can be used.

Declare variables with DefinirDiffers from default
Required. Before using a variable you must declare it with its type, for example Definir edad Como Entero. That includes the counter of every Para.
Give a value before useDiffers from default
Required. Reading a variable, or an array slot, that has no value yet stops the program with an error. That's why accumulators start with something like suma <- 0.
Protected Para counter
You can change the counter inside the Para and keep using it after the loop ends.
Accents and ñ in namesDiffers from default
Not allowed in variable or subroutine names: write anio or posicion. Accented keywords such as Según still work.

Writing style

Punctuation, closing words and how values are assigned.

Semicolon at the endDiffers from default
Required. Every statement ends in ;, as in Escribir "Hola";. Lines that open or close a structure (Si, FinSi, FinPara) don't take one.
Relaxed syntaxDiffers from default
Strict: write every structure in full, with Entonces, Hacer and one-word endings such as FinSi and FinMientras.
Assign with =
Not allowed: you assign only with <-; = is only for comparing.

Operators and conditions

How comparisons are written and text is put together.

Word operators
You can write Y, O, NO and MOD (and, or, not, remainder) as well as their symbols &, |, ~ and %.
Plain-language conditionsDiffers from default
Doesn't accept them: write the comparison with operators, such as x MOD 2 = 0 or x > 5.
Join text with +Differs from default
Not allowed: to show several values together, separate them with commas in Escribir.

Arrays

Where indexes start and how the size is set.

First array indexDiffers from default
Arrays start at 0: after Dimension notas[3] the slots are notas[0], notas[1] and notas[2].
Array size from a variableDiffers from default
Not allowed: the size in Dimension must be a fixed number, such as Dimension datos[10].
Resize arrays
You can change the size of an existing array with Redimensionar.

Loops and Segun

Which ways of repeating and choosing between cases it accepts.

Para Cada loopDiffers from default
Not available: go through arrays with a Para and an index.
Repetir … Mientras QueDiffers from default
A Repetir loop can only end with Hasta Que condition (until).
Para counting downDiffers from default
To count down you must write Con Paso -1; without it, Para i <- 3 Hasta 1 doesn't run at all.
Segun with whole numbersDiffers from default
The value a Segun checks, and its options, must be whole numbers.

Subroutines and text functions

Which extra tools you get to organise the program.

Your own subroutines and functions
You can write your own SubProceso or Funcion to split the program into parts.
Text functions
Available: Longitud, Subcadena, Mayusculas, Minusculas and Concatenar (length, substring, upper case, lower case, join).

An example that follows these rules

It works out the average of three marks. It's written for this profile, and the comments point out what changes compared with the default. We checked it with Codoritmo's interpreter using these same rules.

PerfilFINESIUNAPEstricto.psc · 53 lines
// Example written with the rules of the FINESI UNAP Estricto profile// Every statement ends with a semicolon// Strict syntax: Entonces, Hacer and FinSi always in fullAlgoritmo PerfilFINESIUNAPEstricto    // This profile requires every variable to be declared with Definir    // Variable names have no accents or ñ    Definir notas, suma, i Como Entero;    Definir promedio Como Real;    Definir nombre Como Caracter;    // The array size must be a fixed number    Dimension notas[3];    // Arrays start at 0: the slots are 0, 1 and 2    notas[0] <- 8;    notas[1] <- 9;    notas[2] <- 7;    // Every variable needs a value before it is used    suma <- 0;    // No Para Cada: the array is read with an index    Para i <- 0 Hasta 2 Hacer        suma <- suma + notas[i];    FinPara    promedio <- suma / 3;    nombre <- "Ana";    // + doesn't join text: Escribir separates values with commas    Escribir "Hi, ", nombre;    Escribir "Average: ", promedio;    Si promedio >= 7 Y promedio <= 10 Entonces        Escribir "Passed";    SiNo        Escribir "Failed";    FinSi    // Es Par isn't accepted: the condition uses operators    Si suma MOD 2 = 0 Entonces        Escribir "The sum is even: ", suma;    SiNo        Escribir "The sum is odd: ", suma;    FinSi    // Segun only accepts whole numbers    Segun notas[0] Hacer        10:            Escribir "The first mark is excellent";        8, 9:            Escribir "The first mark is very good";        De Otro Modo:            Escribir "The first mark can improve";    FinSegun    Escribir "Countdown:";    // Counting down needs Con Paso -1    Para i <- 3 Hasta 1 Con Paso -1 Hacer        Escribir i;    FinPara    // Repetir can only end with Hasta QueFinAlgoritmo

What it prints

This is the example's real output, run with the FINESI UNAP Estricto profile.

Hi, Ana
Average: 8
Passed
The sum is even: 24
The first mark is very good
Countdown:
3
2
1
Open in Codoritmo with this profile

Profiles with the same rules

3 profiles use exactly these rules; what you practise here works for them too.

Examples that touch these rules

They open with the default profile; switch to yours from the editor's bottom bar.

  • Grade Average

    Stores five grades in an array and finds the average and the highest.

    Beginner
  • Factorial and Power

    Functions that compute a factorial and a power.

    Intermediate
  • Count Vowels

    Counts the vowels, spaces and other characters in a text.

    Intermediate

Profiles and their descriptions come from the bin/perfiles folder of PSeInt, where each teacher or school contributed their own. Codoritmo ships them unchanged so you can practise with the same rules.

Codoritmo is an independent project inspired by PSeInt and compatible with its syntax; it is not PSeInt and is not affiliated with its authors.