Page 1 sur 1

Python syntax.

Publié : ven. mars 01, 2019 2:17 am
par compsystems
Hello,

in xcas-web

Why "" [enter] returns
ext "

Re: Python syntax.

Publié : ven. mars 01, 2019 10:18 pm
par compsystems
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

Re: Python syntax.

Publié : sam. mars 02, 2019 7:15 pm
par compsystems
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
=> [ ]