print(..., endl="\t" )

Messages in english

Modérateur : xcasadmin

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

print(..., endl="\t" )

Message par compsystems » jeu. avr. 04, 2019 1:37 am

Hello, when running fib(20) in the installable version, the tab character is printed well, in the online version it shows nothing

Code : Tout sélectionner

def fib(n):  # write Fibonacci series up to n Print a Fibonacci series up to n 
        a, b = 0, 1
        while a < n:
            print(a, endl="\t"  )
            a, b = b, a+b
        return Done 
// Parsing fib
Auto-declared local variables : a,b
// Warning: endl,Done, declared as global variable(s). ...
// compiling fib

PD:
I think that the global endl system variable should not be shown as a warning.

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: print(..., endl="\t" )

Message par parisse » jeu. avr. 04, 2019 5:48 am

It's probably normal that \t does not render to HTML.
endl is not a system variable, it's just a workaround (you can avoid the warning by declaring endl as local).

Répondre