Login
|
Signup
langref.org
-
python
add..
all
clojure
cpp
csharp
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Structure
Loops
Perform an action multiple times based on a boolean condition, checked before the first action (WHILE .. DO)
Starting with a variable x=1, Print the sequence
"1,2,4,8,16,32,64,128,"
by doubling x and checking that x is less than 150.
python
x = 1
while x < 150:
print '%s, ' % x,
x *= 2
x = 1
while x < 150:
print '%s, ' % x,
x *= 2
Submit a new solution for
python
There are 19 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
erlang
...)