Python Forum
Complex Jumping In Code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complex Jumping In Code
#1
w=[]
r=0
t=0
q=int(input("How Many Numbers You Wanna Enter: "))
for i in range(q):
    e=input("Enter A Word: ")
    if e.isalpha==True:
        for i in e:
            if i==" ":
                print("Enter A WORD Not A SENTENCE")
                continue
            else:
                w.append(e)
    else:
        print("Use Alphabets Only")
        continue
for i in w:
    r=len(i)
    if t<r:
        t=r
    else:
        continue
for i in w:
    if len(i)==t:
        print("Longest Word Is: ", i)
    else:
        continue
This Code Is For Printing The Longest Word In A List Of Words. Instead Of Using continue, I Wanna Do Something Do Repeat The Iteration, Like When The User Enter A String With Space Or A Digit, The User Is Prompted Again To Enter The Same Value. Using break Will Stop The Whole Program, Which I Definitely Not Wanna Do. What Should I Do? Please Help
Reply


Messages In This Thread
Complex Jumping In Code - by WhamDie - Mar-15-2020, 07:52 AM
RE: Complex Jumping In Code - by Larz60+ - Mar-15-2020, 08:06 AM
RE: Complex Jumping In Code - by buran - Mar-15-2020, 08:16 AM
RE: Complex Jumping In Code - by WhamDie - Mar-15-2020, 09:58 AM
RE: Complex Jumping In Code - by buran - Mar-15-2020, 10:04 AM
RE: Complex Jumping In Code - by ndc85430 - Mar-15-2020, 10:36 AM
RE: Complex Jumping In Code - by WhamDie - Mar-15-2020, 10:43 AM
RE: Complex Jumping In Code - by ndc85430 - Mar-15-2020, 06:59 PM
RE: Complex Jumping In Code - by buran - Mar-15-2020, 07:03 PM
RE: Complex Jumping In Code - by snippsat - Mar-15-2020, 10:03 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020