Python Forum
Code error from Fundamentals of Python Programming van Richard L. Halterman
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code error from Fundamentals of Python Programming van Richard L. Halterman
#3
Can you please show me that in a complete code? I really do not understand what i'am doing wrong. You wrote i have to put the answer in the string but i thought that i do that. The first 2 line work but after that becomes the error. I really don't see it. I'l been trying it for days but i can't get further with my study before i understand this. Can you please show me it into a Code? And what i have to do step by step?

x = input('Please enter an integer value: 2 ')
y = input('Please enter an integer value: 7 ')
num1 = int(x)
num2 = int(y)
print(num1, '+', num2, '=', num1 + num2)
Output:
Please enter an integer value: 2 Please enter an integer value: 7

ERROR!
Error:
Traceback (most recent call last): File "<string>", line 5, in <module> ValueError: invalid literal for int() with base 10: ''
Larz60+ write Jul-12-2023, 05:07 PM:
2nd request:
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.
Again fixed. Please use bbcode tags on future posts, it's forum rules.
Reply


Messages In This Thread
RE: Code error from Fundamentals of Python Programming van Richard L. Halterman - by Heidi - Jul-12-2023, 07:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Syntax error while executing the Python code in Linux DivAsh 8 1,867 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,702 Mar-27-2023, 07:38 AM
Last Post: buran
  Error in if-then-else python code Led_Zeppelin 6 2,552 Jul-27-2022, 07:53 PM
Last Post: deanhystad
  Programming robots using Python OscarBoots 5 3,572 Oct-31-2021, 09:38 AM
Last Post: Larz60+
  Facing error while executing below Python code ramu4651 1 5,854 Jan-26-2021, 06:40 PM
Last Post: ibreeden
  Skeleton file export error Python Code pepapoha 4 3,616 Nov-17-2020, 02:06 AM
Last Post: pepapoha
  Compiling Python 3.8.5 source code results in build error Deepan 0 2,233 Sep-14-2020, 04:11 AM
Last Post: Deepan
  Syntax error in python code sample ErnestTBass 5 3,220 Aug-14-2020, 07:14 PM
Last Post: deanhystad
  Error in Python Code ErnestTBass 4 2,848 Jun-04-2020, 05:28 PM
Last Post: buran
  Python Code error Riteshfrancis 2 2,493 May-21-2020, 06:37 AM
Last Post: Riteshfrancis

Forum Jump:

User Panel Messages

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