Python Forum
while loop not working-I am using sublime text editor
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
while loop not working-I am using sublime text editor
#1
The while loop is not working for the program below. I am using python 3.6 and practicing on sublime text editor:

prompt="\n Please enter the names of the city you have visited in Europe:"
prompt+="\n (Enter 'quit' when you are finished.)"
while True:
	city=input(prompt)
	if city=='quit':
		break
	else:
		print(f"i'd love to go to {city.title()}.")

The out-put is as below:

Please enter the names of the city you have visited in Europe:
(Enter 'quit' when you are finished.)

(I do not understand where to put the value of the city and why it does not run infinitely. It also does not show the last print command). Please see the attached screenshot.
Larz60+ write Feb-06-2023, 02:06 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
while loop not working-I am using sublime text editor - by mma_python - Feb-03-2023, 07:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Text conversion to lowercase is not working ineuw 3 512 Jan-16-2024, 02:42 AM
Last Post: ineuw
  Decryption not working if key has same symbol like text Paragoon2 0 334 Nov-11-2023, 09:32 PM
Last Post: Paragoon2
  ANSI not working for change of text colors BliepMonster 10 3,472 Nov-10-2022, 09:28 AM
Last Post: BliepMonster
  Sublime Text Editor not recognizing Python elroberto 5 2,953 Jun-13-2022, 04:00 PM
Last Post: rob101
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,525 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  Skipping line in text without Restarting Loop IdMineThat 4 1,530 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  Music Notation editor; how to build the editor? direction to go? philipbergwerf 1 1,727 Jan-01-2022, 04:56 PM
Last Post: Larz60+
  Code folding in Sublime Text Mondata 2 2,831 Mar-12-2021, 04:16 PM
Last Post: Mondata
  How to link Sublime Text 3 Build system to Python 3.9 Using Windows 10 Fanman001 2 4,664 Mar-04-2021, 03:09 PM
Last Post: martpogs
  Sublime Text TechNitium 4 2,802 Jan-23-2021, 08:41 AM
Last Post: TechNitium

Forum Jump:

User Panel Messages

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