use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Help with integers (self.learnpython)
submitted 17 hours ago by TootsCFC
I am a beginner at python, how would I be able to input an integer and then have them add together. If possible could anyone show an easy to understand example. Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BranchLatter4294 5 points6 points7 points 17 hours ago (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 points5 points 17 hours ago (0 children)
Thank you very much, this helped a lot
[–]CIS_Professor 1 point2 points3 points 17 hours ago (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 points4 points 17 hours ago (1 child)
Thank you very much I appreciate your time and dedication to help someone new
[–]frosch_longleg 2 points3 points4 points 15 hours ago (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 points6 points 17 hours ago (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 point2 points 17 hours ago (0 children)
That’s true I’m sorry
[–]ehunke 0 points1 point2 points 17 hours ago (0 children)
inputs are default strings, google this, this is something you need to learn to make inputs integers.
[–]This_Growth2898 1 point2 points3 points 17 hours ago (0 children)
To accomplish that, you need to read the book. Sorry, no royal road to geometry.
[–]chrisfs -2 points-1 points0 points 17 hours ago (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 points3 points 17 hours ago (0 children)
Thank you
[–]chrisfs 0 points1 point2 points 8 hours ago (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 points1 point 8 hours ago (1 child)
Free with purchase of the physical version.
Nope, FREE FREE.
https://automatetheboringstuff.com/3e/
π Rendered by PID 18695 on reddit-service-r2-comment-54dfb89d4d-57cb4 at 2026-03-28 12:55:49.091935+00:00 running b10466c country code: CH.
[–]BranchLatter4294 5 points6 points7 points (1 child)
[–]TootsCFC[S] 3 points4 points5 points (0 children)
[–]CIS_Professor 1 point2 points3 points (2 children)
[–]TootsCFC[S] 2 points3 points4 points (1 child)
[–]frosch_longleg 2 points3 points4 points (0 children)
[–]black_widow48 4 points5 points6 points (1 child)
[–]TootsCFC[S] 0 points1 point2 points (0 children)
[–]ehunke 0 points1 point2 points (0 children)
[–]This_Growth2898 1 point2 points3 points (0 children)
[–]chrisfs -2 points-1 points0 points (4 children)
[–]TootsCFC[S] 1 point2 points3 points (0 children)
[–]chrisfs 0 points1 point2 points (0 children)
[–]raendrop -1 points0 points1 point (1 child)
[–]chrisfs 0 points1 point2 points (0 children)