+ 3
Is it possible to use do..while statement on python
6 Réponses
+ 2
why not. Example:
while True:
stuff()
if fail_condition:
break
+ 2
do
{
statement
}while(condition)
we cannot able to use like that??
+ 2
M.MANIVANNAN whatever you mentioned is c++ syntax.. you need to follow proper syntax for the language
+ 2
do...while form do not exists in Python. Also switch... case form is absent.
+ 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.
+ 1
char s;//char declaration
before closing while condition
printf("do u wnt to continue(y/n)");
scanf("%c",&s);
}while(s==y);