0 votes

**'''**

** Online Python Compiler. Code, Compile, Run and Debug python program online.Write your code in this editor and press "Run" button to execute it.**

**'''**

**n=int(input("Enter the values"))a=[]for i in range(1,n+1): a.append(int(input("Enter")))a.sort()**

**print(a)**

commented
Feb 4, 2019
by
asifa

excellent program

0 votes

#Author: Jason Racine

print("=" * 70)

print (" _____ _ _ _ ")

print (" / ____| | \ | | | | ")

print ("| | __ _ _ ___ ___ ___ __ _ | \| |_ _ _ __ ___ | |__ ___ _ __ ")

print ("| | |_ | | | |/ _ \/ __/ __| / _` | | . ` | | | | '_ ` _ \| '_ \ / _ \ '__|")

print ("| |__| | |_| | __/\__ \__ \ | (_| | | |\ | |_| | | | | | | |_) | __/ | ")

print (" \_____|\__,_|\___||___/___/ \__,_| |_| \_|\__,_|_| |_| |_|_.__/ \___|_| \n")

print("=" * 70)

mynumber = 4

guess = ""

count = 0

while True:

try:

guess = int(input("\nGuess a number between 1 and 10: "))

except ValueError:

guess = int(input("That was not a valid entry. Choose a number between 1 and 10: "))

if guess < mynumber:

print("\nToo low\n")

count += 1

elif guess > mynumber:

print("\nToo high\n")

count += 1

elif guess == mynumber:

count += 1

print("\nYou guessed it!!! \n\n In " + str(count) + " tries.\n")

break

else:

print("Invalid Entry!!")

print(" _ _ _ _____ _ _ _ ")

print("| | | | ( ) | __ \| | /\ (_) | |")

print("| | ___| |_|/ ___ | |__) | | __ _ _ _ / \ __ _ __ _ _ _ __ | |")

print("| | / _ \ __| / __| | ___/| |/ _` | | | | / /\ \ / _` |/ _` | | '_ \| |")

print("| |___| __/ |_ \__ \ | | | | (_| | |_| | / ____ \ (_| | (_| | | | | |_|")

print("|______\___|\__| |___/ |_| |_|\__,_|\__, | /_/ \_\__, |\__,_|_|_| |_(_)")

print(" __/ | __/ | ")

print(" |___/ |___/ \n")

number = 7

guess = ""

counter = 0

while True:

try:

guess = int(input("\nGuess a number between 1 and 10: "))

except ValueError:

guess = int(input("That was not a valid entry. Choose a number between 1 and 10: "))

if guess < number:

counter += 1

print("\nToo low\n")

elif guess > number:

counter += 1

print("\nToo high\n")

elif guess == number:

counter += 1

print("\nYou guessed it!!! \n\n In " + str(counter) + " tries.")

break

print("=" * 70)

print (" _____ _ _ _ ")

print (" / ____| | \ | | | | ")

print ("| | __ _ _ ___ ___ ___ __ _ | \| |_ _ _ __ ___ | |__ ___ _ __ ")

print ("| | |_ | | | |/ _ \/ __/ __| / _` | | . ` | | | | '_ ` _ \| '_ \ / _ \ '__|")

print ("| |__| | |_| | __/\__ \__ \ | (_| | | |\ | |_| | | | | | | |_) | __/ | ")

print (" \_____|\__,_|\___||___/___/ \__,_| |_| \_|\__,_|_| |_| |_|_.__/ \___|_| \n")

print("=" * 70)

mynumber = 4

guess = ""

count = 0

while True:

try:

guess = int(input("\nGuess a number between 1 and 10: "))

except ValueError:

guess = int(input("That was not a valid entry. Choose a number between 1 and 10: "))

if guess < mynumber:

print("\nToo low\n")

count += 1

elif guess > mynumber:

print("\nToo high\n")

count += 1

elif guess == mynumber:

count += 1

print("\nYou guessed it!!! \n\n In " + str(count) + " tries.\n")

break

else:

print("Invalid Entry!!")

print(" _ _ _ _____ _ _ _ ")

print("| | | | ( ) | __ \| | /\ (_) | |")

print("| | ___| |_|/ ___ | |__) | | __ _ _ _ / \ __ _ __ _ _ _ __ | |")

print("| | / _ \ __| / __| | ___/| |/ _` | | | | / /\ \ / _` |/ _` | | '_ \| |")

print("| |___| __/ |_ \__ \ | | | | (_| | |_| | / ____ \ (_| | (_| | | | | |_|")

print("|______\___|\__| |___/ |_| |_|\__,_|\__, | /_/ \_\__, |\__,_|_|_| |_(_)")

print(" __/ | __/ | ")

print(" |___/ |___/ \n")

number = 7

guess = ""

counter = 0

while True:

try:

guess = int(input("\nGuess a number between 1 and 10: "))

except ValueError:

guess = int(input("That was not a valid entry. Choose a number between 1 and 10: "))

if guess < number:

counter += 1

print("\nToo low\n")

elif guess > number:

counter += 1

print("\nToo high\n")

elif guess == number:

counter += 1

print("\nYou guessed it!!! \n\n In " + str(counter) + " tries.")

break

0 votes

# author: Jason Racine

lst = []

def frame():

print("=" * 85)

frame()

print("My shopping list program!")

frame()

while True:

print("1. Add an item\n2. View List\n3. Delete an item\n4. Exit\n")

select = int(input("Choose an Option: "))

if select == 1:

item = input("Enter an item to add: ")

lst.insert(0, item)

elif select == 2:

print(lst[0:])

print("\n")

elif select == 3:

ear = input("Enter item to delete: ")

lst.remove(ear)

print(lst)

elif select == 4:

break

print("\n")

lst = []

def frame():

print("=" * 85)

frame()

print("My shopping list program!")

frame()

while True:

print("1. Add an item\n2. View List\n3. Delete an item\n4. Exit\n")

select = int(input("Choose an Option: "))

if select == 1:

item = input("Enter an item to add: ")

lst.insert(0, item)

elif select == 2:

print(lst[0:])

print("\n")

elif select == 3:

ear = input("Enter item to delete: ")

lst.remove(ear)

print(lst)

elif select == 4:

break

print("\n")

0 votes

Here's one simple one:

print ("Press 1 - for Addition")

print ("Press 2 - for Subtraction")

print ("Press 3 - for Multiplication")

print ("Press 4 - for Division")

num1 = input ("Enter a Choice: ")

if num1 == '1' :

numb1 = input ("Enter a number to add: ")

numb2 = input ("Enter another number to add: ")

sum = float(numb1)+float(numb2)

print ('The sum of {0} and {1} is {2}'. format(numb1, numb2, sum))

elif num1 == '2' :

numb1 = input ("Enter a number to subtract: ")

numb2 = input ("Enter another number to subtract: ")

difference = float(numb1)-float(numb2)

print ('The difference of {0} and {1} is {2}'. format(numb1, numb2, difference))

elif num1 == '3' :

numb1 = input ("Enter a number to multiply: ")

numb2 = input ("Enter another number to multiply: ")

mul = float(numb1)*float(numb2)

print ('The product of {0} and {1} is {2}'. format(numb1, numb2,mul))

elif num1 == '4' :

numb1 = input ("Enter a number to divide: ")

numb2 = input ("Enter another number to divide: ")

div = float(numb1)/float(numb2)

print ('The quotient of {0} and {1} is {2}'. format(numb1, numb2, div))

print ("Thank you for using my first calculator : )")

print ("Press 1 - for Addition")

print ("Press 2 - for Subtraction")

print ("Press 3 - for Multiplication")

print ("Press 4 - for Division")

num1 = input ("Enter a Choice: ")

if num1 == '1' :

numb1 = input ("Enter a number to add: ")

numb2 = input ("Enter another number to add: ")

sum = float(numb1)+float(numb2)

print ('The sum of {0} and {1} is {2}'. format(numb1, numb2, sum))

elif num1 == '2' :

numb1 = input ("Enter a number to subtract: ")

numb2 = input ("Enter another number to subtract: ")

difference = float(numb1)-float(numb2)

print ('The difference of {0} and {1} is {2}'. format(numb1, numb2, difference))

elif num1 == '3' :

numb1 = input ("Enter a number to multiply: ")

numb2 = input ("Enter another number to multiply: ")

mul = float(numb1)*float(numb2)

print ('The product of {0} and {1} is {2}'. format(numb1, numb2,mul))

elif num1 == '4' :

numb1 = input ("Enter a number to divide: ")

numb2 = input ("Enter another number to divide: ")

div = float(numb1)/float(numb2)

print ('The quotient of {0} and {1} is {2}'. format(numb1, numb2, div))

print ("Thank you for using my first calculator : )")

...