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
#11
this is what it did for me:
Output:
lt1a/forums/2 /home/forums 6> box try.py +----<try.py>------------------------------------+ | 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) | +------------------------------------------------+ lt1a/forums/2 /home/forums 7> py try.py Please enter an integer value: 2 2 Please enter an integer value: 7 7 2 + 7 = 9 lt1a/forums/2 /home/forums 8>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
Thank you,

I did it wrong, now i understand

With kind regard
Heidi
Reply
#13
simple explanation for others:

if you type just the Return key only, you get an empty string. input() does not get a number from the end of the output.

YOUR CODE needs to check for an empty string and substitute the default input, if that is you intention.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Syntax error while executing the Python code in Linux DivAsh 8 1,626 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,586 Mar-27-2023, 07:38 AM
Last Post: buran
  Error in if-then-else python code Led_Zeppelin 6 2,399 Jul-27-2022, 07:53 PM
Last Post: deanhystad
  Programming robots using Python OscarBoots 5 3,465 Oct-31-2021, 09:38 AM
Last Post: Larz60+
  Facing error while executing below Python code ramu4651 1 5,741 Jan-26-2021, 06:40 PM
Last Post: ibreeden
  Skeleton file export error Python Code pepapoha 4 3,518 Nov-17-2020, 02:06 AM
Last Post: pepapoha
  Compiling Python 3.8.5 source code results in build error Deepan 0 2,194 Sep-14-2020, 04:11 AM
Last Post: Deepan
  Syntax error in python code sample ErnestTBass 5 3,133 Aug-14-2020, 07:14 PM
Last Post: deanhystad
  Error in Python Code ErnestTBass 4 2,749 Jun-04-2020, 05:28 PM
Last Post: buran
  Python Code error Riteshfrancis 2 2,442 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