+ 3

Is it possible to use do..while statement on python

22nd Aug 2018, 4:35 AM
M.MANIVANNAN
M.MANIVANNAN - avatar
6 Respuestas
+ 2
why not. Example: while True: stuff() if fail_condition: break
22nd Aug 2018, 4:49 AM
Md. Mubtashim Fuad
Md. Mubtashim Fuad - avatar
+ 2
do { statement }while(condition) we cannot able to use like that??
22nd Aug 2018, 5:48 AM
M.MANIVANNAN
M.MANIVANNAN - avatar
+ 2
M.MANIVANNAN whatever you mentioned is c++ syntax.. you need to follow proper syntax for the language
22nd Aug 2018, 5:56 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
do...while form do not exists in Python. Also switch... case form is absent.
22nd Aug 2018, 11:55 AM
RoboCybernetic
RoboCybernetic - avatar
+ 1
//program to print 1 for icecream 2 for biscuit and 3 for mobile #include<stdio.h> void main() { int ch; char 'y'; printf("1.ICECREAM 2.BISCUIT 3.MOBILE"); do { printf("ENTER UR OPTION"); scanf("%d",&ch); switch(ch) { case 1:printf("icecream"); break; case 2:printf("biscuit"); break; case 3:printf("mobile"); break; } }while(ch<4); } anyone convert the coding into python language.i think switch case is not in python so we have to use ifelse(elif). but how to apply do..while.
22nd Aug 2018, 6:52 AM
M.MANIVANNAN
M.MANIVANNAN - avatar
+ 1
char s;//char declaration before closing while condition printf("do u wnt to continue(y/n)"); scanf("%c",&s); }while(s==y);
22nd Aug 2018, 6:55 AM
M.MANIVANNAN
M.MANIVANNAN - avatar