• Kurse
  • Code Compiler
  • Diskutieren
  • Preise
  • Teams
Menu
0

What if I code something like : list(range(1,26,0))? Will it make a list with 26 1's?

I want to make a list with same numbers without using a loop.

python
23rd Oct 2016, 8:29 AM
sya sya
sya sya - avatar
2 Antworten
+ 4
List with 26 1's: [1]*26 http://b.wardje.eu/2012/09/initialise-JUMP_LINK__&&__python__&&__JUMP_LINK-list-to-length-with.html
23rd Oct 2016, 9:17 AM
Zen
Zen - avatar
+ 2
you can't set the step argument to be 0. so just do: [n]*m
23rd Oct 2016, 9:26 AM
w0rmh013
w0rmh013 - avatar

Häufig solche Fragen?

Effizienter lernen, kostenlos:

  • Einführung in Python

    7.1M Lernende

  • Einführung in Java

    4.7M Lernende

  • Einführung in C

    1.5M Lernende

  • Einführung in HTML

    7.5M Lernende

Alle Kurse anzeigen
Heute heiß
When your heart are gone
1 Votes
Hi im a begneer and i dont understand how to code if anyone whos smart replay
1 Votes
Python question
3 Votes
i want correct anwer code
0 Votes
Where do I find saved code?
1 Votes
I am a beginner here
1 Votes
Hello everyone, umm i downloaded this app today , and I am a bit confused about this
0 Votes
In data science, which part is easy to learn and which is hard, and why? Which part is most important to data science?
1 Votes
SVG Animation: Container Problems - Any Suggestions?
0 Votes
is it too easy to be top 1 in the Earth league
0 Votes