Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Created by Hybrid ~ Please don't steal :(
- import os
- #Reset Function
- def reset():
- print("\n" * 2)
- restart()
- # User enters a number and then the number and all of the numbers below it are outputed squared
- def squarerootlist():
- inp = int(input("Enter a number and that number and all of the numbers below it will be displayed squared: "))
- for i in range(inp):
- if i != 0:
- print(inp * inp, " - ", inp)
- inp -= 1
- print("1 - 1")
- #Palindrome Check Test
- def reverse(num):
- if int(str(num)[::-1]) == num:
- print("The number",num, "is a palindrome")
- reset()
- if int(str(num)[::-1]) != num:
- print("The number", num, "is not a palindrome")
- reset()
- #User's choice
- def restart():
- choiceinp = str(input("(For help type Help, if you want to exit, type exit)\nEnter what you'd like to do, (Add - 1, Subtract - 2, Multiply - 3, Divide - 4, Square Root List - 5, Square a Number - 6, Palindrome Check - 7): ")).lower()
- def start():
- if choiceinp == "exit":
- exit()
- if choiceinp == "help":
- print("\n\nType the number you want for the operation you want\n1 - Addition (Type one number, press enter, type another number, press enter for the total)\n2 - Subtraction (Enter a number, press enter, enter another number, press enter for the difference)"
- "\n3 - Multiplication (Enter one number, press enter, enter another, press enter for the product)\n4 - Division (Enter one number, press enter, type another number, press enter for the quotient)"
- "\n5 - Square Root List (Enter a number, it will show you the number squared and all of the numbers below it squared)\n6 - Square a Number (Squares a number)\n7 - Palindrome Check (Checks to see if the number is a palindrome or not)"
- "")
- # This ^^^ is for more help as more funtions are added
- os.system("pause")
- if choiceinp == "5":
- squarerootlist()
- if choiceinp == "7":
- num = int(input("Enter a number to find out if it's a palindrome: "))
- reverse(num)
- elif choiceinp != "1" or "2" or "3" or "4" or "5" or "6" or "7" or "help":
- os.system("pause")
- restart()
- start()
- #Call's the program to be started
- restart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement