Python Forum
bad input line 3 how t fix it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bad input line 3 how t fix it
#2
remove the quotes on print

hrs = input("Enter Hours:")
h = float(hrs)
if h <= 40:
    rate = 1.5
    print(h * rate)
elif h > 40.0 :
    rate = 10.5
    print(h * rate)
shorter version

hrs = float(input("Enter Hours:"))
print(hrs * 1.5) if hrs <= 40 else print(hrs * 10.5)
Reply


Messages In This Thread
bad input line 3 how t fix it - by youssef210 - Aug-27-2020, 10:43 AM
RE: bad input line 3 how t fix it - by Axel_Erfurt - Aug-27-2020, 01:42 PM
RE: bad input line 3 how t fix it - by nilamo - Aug-27-2020, 04:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Receive Input on Same Line? johnywhy 8 850 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  How to input & output parameters from command line argument shantanu97 1 2,624 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  How to make input come after input if certain line inserted and if not runs OtherCode Adrian_L 6 3,386 Apr-04-2021, 06:10 PM
Last Post: Adrian_L
  Multi-line console input lizze 4 2,446 Dec-26-2020, 08:10 AM
Last Post: lizze
  Line charts error "'isnan' not supported for the input types," issac_n 1 2,464 Jul-22-2020, 04:34 PM
Last Post: issac_n
  Taking Multiple Command Line Argument Input bwdu 6 4,120 Mar-29-2020, 05:52 PM
Last Post: buran
  How to make input goto a different line mxl671 2 2,510 Feb-04-2020, 07:12 PM
Last Post: Marbelous
  command line input (arg parse) and data exchange Simba 7 4,399 Dec-06-2019, 11:58 PM
Last Post: Simba
  Multiple Line Input helenaxoxo 4 2,989 Dec-02-2019, 11:06 PM
Last Post: helenaxoxo
  A question about subprocess taking input from command line and returning output! Aurimas 8 5,305 May-15-2019, 04:02 PM
Last Post: Aurimas

Forum Jump:

User Panel Messages

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