Python syntax.

Bugs

Modérateur : xcasadmin

compsystems
Messages : 518
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Python syntax.

Message par compsystems » ven. mars 01, 2019 2:17 am

Hello,

in xcas-web

Why "" [enter] returns
ext "

compsystems
Messages : 518
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Python syntax.

Message par compsystems » ven. mars 01, 2019 10:18 pm

Hello BP

prinf and printf cmds are not interpreting the escape character \t (tabulation)
in the entry and output history ok

"This is the string in the first line\nand this is the second string in a second line\n\tand now a third tabulated" [enter] returns

This is the string in the first line
and this is the second string in a second line
↦↦↦and now a third tabulated

with print() cmd


print("This is the string in the first line\nand this is the second string in a second line\n\tand now a third tabulated" ) [enter] prints

This is the string in the first line
and this is the second string in a second line
and now a third tabulated


with printf() cmd

printf("This is the string in the first line\nand this is the second string in a second line\n\tand now a third tabulated" ) [enter] prints
This is the string in the first line
and this is the second string in a second line
and now a third tabulated


"\"This is the string in the first line\nand this is the second string in a second line\n\tand now a third tabulated\"" [enter] returns

"This is the string in the first line
and this is the second string in a second line
↦↦↦and now a third tabulated"

session Xcas

compsystems
Messages : 518
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: Python syntax.

Message par compsystems » sam. mars 02, 2019 7:15 pm

Letters = ["a", "b", "c", "d", "e", "f", "g"] [enter] returns
["a","b","c","d","e","f","g"]

Letters[2:5] := ["C", "D", "E"] # replace some values [enter] returns
["a", "b", "C", "D", "E", "f", "g"]

now remove 2..5 them
letters[2:5] = [ ] [enter] returns
Invalid dimension
=> [ "a", "b", "f", "g"]

Letters[ : ] = [ ] # clear the list by replacing all the elements with an empty list [enter] returns
Error
=> [ ]

Répondre