I am fairly new to programming in general and I am currently reading introduction to C# on university level and early next year i'll be reading Python and Pearl, so I thought it might be a good idea to start early with atleast one of the languages.

So this is my Program, tell me what you think of it.

What should I think about in the future? what is done wrong? what is done right?

Something that I find very interesting is to try and make my code as foolproof as possible from the user-end, so feel free to crash

it and come back to me with what I should think about when it comes to the end-user side of code.

__author__ = 'Zoap' def Search(): inv = "\nInvalid input" invx = "\nNumber to search for must be a number!" invs = "\nLength must be a number!" print("\nThis program allows you to search for the number of possible combinations of a pin number of length x, " "given that you know one of the digits") x = str(input("\nInput number to search for: ")) if x.isdigit() is False: print(invx) Search() return elif x.isdigit() is True: def PinLength(): s = str(input("\nInput length of pin code: ")) if s.isdigit() is False: print(invs) PinLength() return elif int(s) > 7: print("\nLength can not be more than 7 digits!") PinLength() return import math stop = int((math.pow(10, int(s)))) if stop < int(x): print("\nLength of pin makes the number to search for bigger than the possible number of variations!") Search() return elif s.isdigit() is True: def CalcForLoop(): number_list = [] # For every integer in range add int to list and convert to string for i in range(0, (stop + 1)): number_list.append(str(i)) # For every str in list containing x, count x x_numbers = [a for a in number_list if x in a] # Percent of total numbers in range containing digit x percent = len(x_numbers) / (stop / 100) if int(x) >= 10: print("\nThere are a total of " + str(len(x_numbers)) + " numbers between 0 and " + str(stop) + " containing the number " + x) print("\nThat is a total of " + str("%.2f" % percent) + "%" " of all numbers between 0 and " + str(stop)) elif int(len(x_numbers)) is 1: print("\nThere are a total of " + str(len(x_numbers)) + " number between 0 and " + str(stop) + " containing the digit " + x) print("\nThat is a total of " + str("%.2f" % percent) + "%" " of all numbers between 0 and " + str(stop)) else: print("\nThere are a total of " + str(len(x_numbers)) + " numbers between 0 and " + str(stop) + " containing the digit " + x) print("\nThat is a total of " + str("%.2f" % percent) + "%" " of all numbers between 0 and " + str(stop)) def RunAgain(): yes = "y" or "Y" no = "n" or "N" choice = input("\nRun again? y/n: ") if choice is yes: Search() return elif choice is no: exit() else: print(inv) RunAgain() return RunAgain() CalcForLoop() PinLength() Search()

This post has been edited by **jon.kiparsky**: 30 November 2015 - 07:21 PM

Reason for edit:: added code to post for convenience of the reader