15,908,907 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Prayash Bhuyan (Top 6 by date)
Prayash Bhuyan
10-Apr-23 9:26am
View
okay and thank you very much
Prayash Bhuyan
10-Apr-23 9:18am
View
I saw your solution and i really appreciate you trying to help me but this is also what i donot want i want suppose the list is [ayush,nayan,bhargav,niju,money]
the program runs and promts
type a name: ayush
ayush you group is 5
and then it shouldnot break it should be like
type a name:ayush
ayush your group is 5
type a name;bhargave
bhargav your group is 1
type a name: aaa(since it is not in the lst again promt type a name)
and this type a name promt should end only when all the write names in the list is over even in between ar in start the user enters a wrong name it should not consider it as a iteration of it owns
Prayash Bhuyan
10-Apr-23 4:50am
View
Also once the for loop runs if the user enters a wrong input it should not also count that as an iteration
Prayash Bhuyan
10-Apr-23 4:49am
View
I got what you said but what i am saying is that that works fine but i want the for loop to run only when the name is in the lsit and if not it should repromt the user but the promting message shouldnot be counted as iteration but in my programe it is counting it as a iteration...
Prayash Bhuyan
10-Apr-23 0:35am
View
For doing what i intended to do i cehcked the if statement first so it is not considering it to be interation but now the problem is if one name is in ht elist it prints all the name together and doesnot ask the user for names again and again
import random
names=["ayush","bhargav","nayan","money","niju"]
active=True
while active:
name=input("what is your name: ")
if name in names:
for name in names:
name=name.casefold()
group=random.randint(1,5)
print(name,"your group is",group)
active=False
else:
continue
Prayash Bhuyan
9-Apr-23 23:54pm
View
Hey the flag actually worked but not exactly i am able to break out of the loop but what i want is that when the name is not in the list the for loop shouldnot run it should just promt the user but here it considering it to be one iteration can you help?
Show More