Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
while sentence
#3
Welcome to the forums :)

The syntax highlighting should make it clear, but line 5 is a syntax error. There's a single quote in the middle of the string that ends the string prematurely. Either wrap the string in double quotes, or in triple quotes:
#currently
ans=str(input('if Javab is higher please enter k and  it is lower please enter b and if it's equal enter d'))

# double quotes
ans=str(input("if Javab is higher please enter k and  it is lower please enter b and if it's equal enter d"))

# triple quotes
ans=str(input('''if Javab is higher please enter k and  it is lower please enter b and if it's equal enter d'''))
Also, the last line will overwrite the print() function with "yes it's true" instead of printing anything. The assignment is almost definitely a typo.

If those don't fix your issue, please share the traceback Python gives, or explain what the issue is if it's logical instead of syntactical.
Reply


Messages In This Thread
while sentence - by kimyyya - Mar-19-2021, 07:34 PM
RE: while sentence - by deanhystad - Mar-19-2021, 07:54 PM
RE: while sentence - by nilamo - Mar-19-2021, 09:57 PM
RE: while sentence - by Pedroski55 - Mar-20-2021, 06:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List / arrays putting in sentence Kurta 3 2,597 Dec-25-2020, 11:29 AM
Last Post: Larz60+
  How to make a telegram bot respond to the specific word in a sentence? Metodolog 2 6,424 Dec-22-2020, 07:30 AM
Last Post: martabassof
  How to match partial sentence in long sentence Mekala 1 1,552 Jul-22-2020, 02:21 PM
Last Post: perfringo
  Remove a sentence if it contains a word. lokhtar 6 6,004 Feb-11-2020, 04:43 PM
Last Post: stullis
  Regex Help for clubbing similar sentence segments regstuff 3 2,187 Nov-20-2019, 06:46 AM
Last Post: perfringo
  how to get all the possible permutation and combination of a sentence in python sodmzs 1 4,209 Jun-13-2019, 07:02 AM
Last Post: perfringo
  Sentence maker help bidoofis 2 2,535 Feb-08-2019, 03:59 AM
Last Post: bidoofis
  wont print last sentence.. mitmit293 2 2,430 Jan-27-2019, 05:38 PM
Last Post: aakashjha001
  Generating all simple sentence possibilities Max_77 3 2,838 Oct-10-2018, 11:35 AM
Last Post: Max_77
  PigLatin Sentence Translator Help 2skywalkers 7 5,910 Jun-23-2018, 12:46 AM
Last Post: 2skywalkers

Forum Jump:

User Panel Messages

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