cleaner version of variable, new line
MRAB
python at mrabarnett.plus.com
Thu May 24 22:03:36 EDT 2018
On 2018-05-25 01:50, asa32sd23 at gmail.com wrote:
> hi just seeing if there is a cleaner way to write this.
>
> s1= "kitti"
> s2= 'kitti'
> i= 3
> print(s1+ "\n" + "="*i + "^" + "\n" +s2)
>
>>
> kitti
> ===^
> kitti
>
When printing, I'd probably just go for something clear and simple:
print(s1)
print("=" * i + "^")
print(s2)
There's no need to cram it all onto one line.
More information about the Python-list
mailing list