Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Logic in Python Around and Around

Justin Ricke
PLUS
Justin Ricke
Courses Plus Student 345 Points

Are there do while loops in Python?

Just curious if there are do while loops in Python?

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

No, I don't think there are. I've seen a couple of posts about this and what I've read is that they're aren't. Here's the python documentation and they aren't mentioned there either (that I can see). https://docs.python.org/2/tutorial/controlflow.html

However, having dealt with other programming languages I can say that I feel fairly certain any do while loop can be rewritten as a while loop with proper setup in advance. Just my experience and opinion, though :)