##### Beginner Problem python 2.7
 Beginner Problem python 2.7 Jonathan_levy Unladen Swallow Posts: 3 Threads: 3 Joined: Jul 2018 Reputation: Jul-04-2018, 08:29 PM i am using pycharm the lastest version and inteprter python 2.7 ```def sum_two_or_more(x1, x2, *args): if args: second = sum_two_or_more(x2, *args) else: second = x2 return x1 + second sum_two_or_more(1, 2)```i tried to run it and what printed out was: Process finished with exit code 0 with nothing else and it did it to me with some others code like it doesnt have a problem or an error with the code i did but it didnt do what the code meant to do either Reply gontajones Minister of Silly Walks Posts: 333 Threads: 4 Joined: Jun 2018 Reputation: Jul-04-2018, 08:44 PM (This post was last modified: Jul-04-2018, 08:44 PM by gontajones.) If you want to see something in console, you have to use print(). ```def sum_two_or_more(x1, x2, *args): if args: second = sum_two_or_more(x2, *args) else: second = x2 return x1 + second # Pay attention to the indentation print sum_two_or_more(1, 2) print(sum_two_or_more(1, 2)) # <- Python3```I recommend you to use/learn python3. Reply ichabod801 Bunny Rabbit Posts: 4,231 Threads: 97 Joined: Sep 2016 Reputation: Jul-04-2018, 08:46 PM One, you want to unindent the return statement. It's not a problem here, but if you give it three values, it will return None. Two, try printing the result. As in: `print(sum_two_or_more(1, 2))`Three, upgrade to Python 3.6. Support for 2.7 is ending in a couple years. Craig "Ichabod" O'Brien - xenomind.com I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures Reply

 Possibly Related Threads… Thread Author Replies Views Last Post small beginner problem FelixReiter 2 712 Nov-17-2020, 03:26 PM Last Post: FelixReiter Beginner having Syntax Error problem RyanHo 3 1,107 Sep-10-2020, 08:33 AM Last Post: cnull Beginner, my recursion returns None, and related problem zpacemanzpiff 2 790 Jul-02-2020, 04:25 AM Last Post: zpacemanzpiff Beginner problem, replace function with for loop Motley_Cow 9 2,233 Sep-13-2019, 06:24 AM Last Post: Motley_Cow Beginner problem in python script Cedmo 3 1,481 Jul-04-2019, 08:22 PM Last Post: Cedmo Beginner Problem python 2.7 Jonathan_levy 2 1,765 Jul-03-2018, 11:58 AM Last Post: gruntfutuk problem about 'if' and 'for' from a python beginner yzjnpu 3 2,005 Jun-26-2018, 03:47 PM Last Post: buran Beginner. Calculator problem ¯\_(ツ)_/¯ stykus1992 0 1,561 Feb-15-2018, 11:01 AM Last Post: stykus1992

Forum Jump:

### User Panel Messages

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