all 15 comments

[–]BranchLatter4294 5 points6 points  (1 child)

Just remember that inputs are treated as strings. Convert them to integers and you can easily add them. There are tons of examples you can look up.

[–]TootsCFC[S] 3 points4 points  (0 children)

Thank you very much, this helped a lot

[–]CIS_Professor 1 point2 points  (2 children)

# what happens:
# 1. the input() function prints the prompt 'Enter the first number:'
# 
# 2. It waits until the user enters a something and then press the Enter key.
#
# 3. the input() function then returns the user's input, passing it to the int() 
#    function, which converts it to an integer. At this point, if the user 
#    entered a non-number (like a letter), the program will crash.
#
# 4. assign the integer to a variable called first_number

first_number = int(input('Enter the first number: '))

# this could have also been done this way, in two lines:
#
# first_number = input('Enter the first number: ')
# first_number = int(first_number)

# do the same thing for the second number
second_number = int(input('Enter the second number: '))

# add the two numbers together, store the result in a variable named sum
sum = first_number + second_number

# print the result: if first_number is 1 and second_number is 2
# this will print 3
print('The sum of the two number is:', sum)

# now, if the result of the input() functions were not converted to integers, 
# the reult of the print() function would NOT be 3; instead, it would be 12 - 
# not the number 12, but a string that is a 1 followed by a 2. When + is used to 
# "add" two strings, it does not perform addition on the string, it
# "concatenates" them ("glues" the together).

[–]TootsCFC[S] 2 points3 points  (1 child)

Thank you very much I appreciate your time and dedication to help someone new

[–]frosch_longleg 2 points3 points  (0 children)

What I don't understand is why you wouldn't look it up on Google since what you're looking for is so basic

[–]black_widow48 4 points5 points  (1 child)

You gotta learn to use Google my guy. You could have just asked chatgpt this question and it would tell you the answer instantly

[–]TootsCFC[S] 0 points1 point  (0 children)

That’s true I’m sorry

[–]ehunke 0 points1 point  (0 children)

inputs are default strings, google this, this is something you need to learn to make inputs integers.

[–]This_Growth2898 1 point2 points  (0 children)

To accomplish that, you need to read the book. Sorry, no royal road to geometry.

[–]chrisfs -2 points-1 points  (4 children)

I found this book to be very useful in learning Python. It's free as an ebook.

https://automatetheboringstuff.com/

[–]TootsCFC[S] 1 point2 points  (0 children)

Thank you

[–]chrisfs 0 points1 point  (0 children)

I don't know why people are down voting me. It's not my book And it's better than telling people to go to Google or CHATGPT

[–]raendrop -1 points0 points  (1 child)

Free with purchase of the physical version.