This is Python code to sort the numbers in ascending order input: 3,0,1,4,2 out:0,1,2,3,4 Example is my: numbers = input("Enter numbers separated by a comma: ") numbers = [int(n) for n in numbers.split(',')] end = len(numbers) - 1 while end != 0: for i in range(end): if numbers[i] > numbers[i + 1]: numbers[i], numbers[i + … Continue reading Sort numbers in ascending order using Python

Tag: python

# Prime Number Generator (6n + 1 or 6n – 1)

Prime Number Generator (6n + 1 or 6n - 1) This generator is like most where it brute forces an integer: it see whether the integer is divisible by any of the primes; if so, then it's not a prime and vice versa. This though only compares values 6n + 1 and 6n - 1 starting with n as 1 as … Continue reading Prime Number Generator (6n + 1 or 6n – 1)

# Simple budget program in python

I've decided to start working on a budget application for the purposes of enhancing my Python skills. In its current form this program takes given expenses and income and tells the user whether they have a surplus, a deficit, or if they are breaking even. Example: import os import sys class Application(): def __init__(self): self.income … Continue reading Simple budget program in python