Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/basics/list_mult.py

13 lines
249 B
Python
Raw Normal View History

py: Fix mult by negative number of tuple, list, str, bytes. Multiplication of a tuple, list, str or bytes now yields an empty sequence (instead of crashing). Addresses issue #799 Also added ability to mult bytes on LHS by integer.
2014-08-13 13:22:24 +01:00
# basic multiplication
list: Implement list multiplication.
2014-01-10 18:12:25 +02:00
print([0] * 5)
py: Fix mult by negative number of tuple, list, str, bytes. Multiplication of a tuple, list, str or bytes now yields an empty sequence (instead of crashing). Addresses issue #799 Also added ability to mult bytes on LHS by integer.
2014-08-13 13:22:24 +01:00
# check negative, 0, positive; lhs and rhs multiplication
for i in (-4, -2, 0, 2, 4):
print(i * [1, 2])
print([1, 2] * i)
# check that we don't modify existing list
list: Implement list multiplication.
2014-01-10 18:12:25 +02:00
a = [1, 2, 3]
c = a * 3
py: Fix mult by negative number of tuple, list, str, bytes. Multiplication of a tuple, list, str or bytes now yields an empty sequence (instead of crashing). Addresses issue #799 Also added ability to mult bytes on LHS by integer.
2014-08-13 13:22:24 +01:00
print(a, c)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 47ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API