Difficulties with funtions and syntax in python - python

I have written a program for a homework assignment, that should function as a mock grocery list that will calculate how much the items should cost as well.
grocery_item = {}
grocery_history=[{'name': 'milk', 'number': int(1), 'price': float(2.99)},
{'name': 'eggs', 'number': 2, 'price': 3.99},
{'name': 'onions', 'number': 4, 'price': 0.79}]
stop = 'go'
item_name = "Item name"
quantity = "Quantity purchased"
cost = "Price per item"
print ("Item name:")
print ("Quantity purchased:")
print ("Price per item:")
cont = 'c'
while cont != 'q':
item_name = "milk"
quantity = "Quantity purchased"
quantity = 2
cost = "Price per item"
cost = 2.99
grocery_history.append(item_name)
grocery_history.append(quantity)
grocery_history.append(cost)
grocery_item['name'] = item_name
grocery_item['number'] = quantity
grocery_item['price'] = cost
print("Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n")
cont = 'c'
item_name = "eggs"
quantity = "Quantity purchased"
quantity = 1
cost = "Price per item"
cost = 3.99
grocery_history.append(item_name)
grocery_history.append(quantity)
grocery_history.append(cost)
grocery_item['name'] = item_name
grocery_item['number'] = quantity
grocery_item['price'] = cost
"Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n"
cont = 'c'
item_name = "onions"
quantity = "Quantity purchased"
quantity = 4
cost = "Price per item"
cost = 0.79
"Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n"
cont = 'q'
grand_total = []
number = grocery_item['number']
price = grocery_item['price']
for grocery_history in grocery_item:
item_total = number*price
grand_total.append(item_total)
print (grocery_item['number'] + ['name'] + "#" + ['price'] + "ea" + ['item_total'])
item_total = 0
print (grand_total)
This is the error I get:
print (grocery_item['number'] + ['name'] + "#" + ['price'] + "ea" + ['item_total'])
TypeError: unsupported operand type(s) for +: 'int' and 'list'
There are multiple problems with this code.
I am supposed to use the %.2f to get the price in dollar form, but I have no idea how, and the things I've tried haven't worked.
There are syntax errors in my print(grocery_item) statement.
The code doesn't run through the list grocery_history, and just repeats with the same input over and over.

To get a formatted print with the fields from the dict you can use .format() like:
print('{number} {name} # {price:.2f} ea'.format(**grocery_item))

You have an error because you are adding string to floats. Python does not know how to do that.
As #Stephen Rauch showed, you can do it in one line with a very pythonic structure. If you want you can use the syntax
'%s\t%s\t...'%(my_variable1, my_variable2)
Which works great as well.

I assume you wanted to add items to already existing grocery_history and then calculate the grand total of all your groceries (using Stephen Rauch's printing answer).
grocery_history=[{'name': 'milk', 'number': int(1), 'price': float(2.99)},
{'name': 'eggs', 'number': 2, 'price': 3.99},
{'name': 'onions', 'number': 4, 'price': 0.79}]
cont = 'c'
grand_total = 0
while cont != 'q':
num = input("How many bottles of milk do you want to buy? ")
grocery_history[0]['number'] += num
num = input("How many eggs do you want to buy? ")
grocery_history[1]['number'] += num
num = input("How many onions do you want to buy? ")
grocery_history[2]['number'] += num
cont = raw_input("Enter c to continue or q to quit: ")
while cont not in ['c', 'q']:
cont = raw_input("Wrong choice, enter your choice again: ")
for grocery_item in grocery_history:
item_total = grocery_item['number'] * grocery_item['price']
grand_total += item_total
print('${:.2f} for {number} {name} # {price:.2f} ea'.format(item_total, **grocery_item))
print ("Grand total is ${:.2f}".format(grand_total))
Some of what went wrong:
You weren't actually asking the user to enter c or q, so you just went once over the list and exited in the end because of cont = 'q'.
You were constantly overwriting your variables, for example:
quantity = "Quantity purchased"
quantity = 2
First line assigns string and the second - integer. You can operate directly on dict values, provided you know how to access them.
This part:
number = grocery_item['number']
price = grocery_item['price']
assigned the last actually updated grocery_item (eggs) and you did all your calculations in for loop with these two values.
Here:
grocery_history.append(item_name)
grocery_history.append(quantity)
grocery_history.append(cost)
you were appending strings and numbers to a list of dictionaries.

Related

Line (39) IndexError: pop index out of range

This is my code:
#cart is a list, easy to append
cart=['S/n'," "*10, 'Items', " " * 14, "Quantity", " " * 8, "Unit Price", " " * 8, "Price"]
total_pricee = 0
pricee = 0
count=1
from datetime import datetime
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print( "Date & Time:",dt_string)
print('Welcome to tis program.Please use the numbers to navigate!')
def invalid_input(Quantitiy):
while Quantitiy > '5' or Quantitiy < '1':
Quantitiy = input("Please key in a valid quantity(Between 1 to 5):")
if Quantitiy < '5' and Quantitiy > '1':
New_Quan=Quantitiy
#This part of function checks if item quantity is between 1 and 5
return Quantitiy
break
while not Quantitiy.isdigit():
Quantitiy = input('Invalid input.Please enter a valid input:')
while Quantitiy.isdecimal() == False:
break
#This part of function checks that item quantity is not a decimal
return Quantitiy
def add_to_cart(name, Quantity, price):
global total_pricee, pricee,count,cart
#This function adds items to cart
cart.append('\n')
cart.append('{:<10s}'.format(str(count) + '.'))
cart.append('{:^10s}'.format(name))
cart.append('{:^30s}'.format(str(Quantity)))
cart.append('$'+str(price)+'0')
pricee = '{:.2f}'.format(float(Quantity) * price)
pricee
cart.append('{:^34s}'.format('$' +str(pricee)))
total_pricee += float(pricee)
count = count +1
print(name,"has been added to cart!")
def remove_from_cart(Item_number):
global count
while True:
if Item_number>(count-1):
print('Please key in a valid S/n!')
(Item_number)=int(input('Please enter the S/n of the item you want to remove:'))
if Item_number==2:
cart.pop(9)
cart.pop(9)
cart.pop(9)
cart.pop(9)
cart.pop(9)
cart.pop(9)
if Item_number<=(count-1):
x=(6*(Item_number-2))+9
cart.pop(x)
cart.pop(x)
cart.pop(x)
cart.pop(x)
cart.pop(x)
cart.pop(x)
print('Item has been sucsussfully removed from cart!')
if count==1:
print('Please add an item to cart first!')
while True:
print('[1] Water')
print('[2] rice')
print('[3] ice')
print('[0] View Cart and Check-out')
print("[4] Remove object from cart")
opt = input("Select option:")
if opt > '4' or opt < '0':
print("Select valid option!")
if opt == '3':
qunt = input("Please key in a quanity for your item:")
qunt =invalid_input(qunt)
nam3 = "Ice"
add_to_cart(nam3, qunt, 2.00)
if opt == '1':
qunt2 = input("Please key in a quanity for your item:")
qunt2=invalid_input(qunt2)
nam2 = " Water"
add_to_cart(nam2, qunt2, 3.00)
if opt == '2':
qunt1 = input("Please key in a quanity for your item:")
qunt1=invalid_input(qunt1)
nam1 = "Rice"
add_to_cart(nam1, qunt1, 5.00)
if opt == "0":
print(*cart)
print("Total price until now:", "$" + '{:.2f}'.format(total_pricee))
print('Would you like to check out?')
print('[1] Yes')
print('[2] No')
checkout=input("Please select an option:")
if checkout=='1':
print('You have bought',count,'items')
print("Please pay""$" + '{:.2f}'.format(total_pricee))
print('Thank you for shopping with us!')
exit()
if opt=="4":
print(*cart)
remove=input("Please key in the S/n of the item you want to remove:")
remove_from_cart(int(remove))
print(*cart)
I do not know why this error is occurring .I am a bit new to python and have not encounter such error before.Please tell me how to improve my code such that this error does not occur again. Thanks to anyone who helps!
For eg:
S/n Items Quantity Unit Price Price
1. Rice 3 $5.00 $15.00
2. Rice 4 $5.00 $20.00
3. Water 4 $3.00 $12.00
and user wants to remove the second item, it the output after the function has been carried out should be
S/n Items Quantity Unit Price Price
1. Rice 3 $5.00 $15.00
2. Water 4 $3.00 $12.00
I can't paste the formatted code in the comment, I will write it in the answer, I hope to understand.
The list is very inconvenient to do this operation
In [1]: import pandas as pd
In [5]: d = pd.DataFrame([['Rice', 3, '$5.0', '$15.0'], ['Water', 4, '$3.0', '$12.0']], columns=['Items', 'Quantity', 'Unit Price', 'Price'])
In [6]: d
Out[6]:
Items Quantity Unit Price Price
0 Rice 3 $5.0 $15.0
1 Water 4 $3.0 $12.0
In [7]: d.drop(0)
Out[7]:
Items Quantity Unit Price Price
1 Water 4 $3.0 $12.0
In [16]: d.append([{"Items": "Rice", "Quantity": 3, "Unit Price": "$5.0", "Price": "$20.0"}], ignore_index=True)
Out[16]:
Items Quantity Unit Price Price
0 Rice 3 $5.0 $15.0
1 Water 4 $3.0 $12.0
2 Rice 3 $5.0 $20.0
Here's my code, maybe for your reference :)
from itertools import repeat
class Cart():
def __init__(self):
self.header = ['S/N', 'Items', 'Quantity', 'Unit Price', 'Price']
(self.SN_width, self.item_width, self.quantity_width,
self.unit_price_width, self.price_width
) = self.widths =[13, 19, 16, 18, 20]
self.item_list = {}
def get_serial_no(self):
i = 1
while i in self.item_list:
i += 1
return i
def add(self, item, quantity, unit_price):
serial_no = self.get_serial_no()
self.item_list[serial_no] = (item, quantity, unit_price)
def delete(self, serial_no):
del self.item_list[serial_no]
lst = sorted(self.item_list.keys())
new_list = {i+1:self.item_list[key] for i, key in enumerate(lst)}
self.item_list = new_list
def sum_all(self):
all_price = 0
for item, quantity, unit_price in self.item_list.values():
all_price += quantity*unit_price
return all_price
def adjust(self, items):
line = ['']*5
for i in range(5):
if i == 0:
line[0] = items[0].center(self.widths[0])
elif i == 1:
line[1] = items[1].ljust(self.widths[1])
else:
line[i] = items[i].rjust(self.widths[i])
return ' '.join(line)
def __repr__(self):
keys = sorted(self.item_list.keys())
title = self.adjust(self.header)
seperator = ' '.join(list(map(str.__mul__, repeat('-'), self.widths)))
result = [title, seperator]
for key in keys:
lst = self.item_list[key]
items = [str(key), lst[0], '%.3f'%lst[1], '$%.3f'%lst[2],
'$%.3f'%(lst[1]*lst[2])]
line = self.adjust(items)
result.append(line)
return '\n'.join((' ', '\n'.join(result), ' ',
'Total price: $%.3f'%self.sum_all(), ' '))
cart = Cart()
new_items = [
('apple', 10, 1), ('orange', 5, 0.5), ('banana', 20, 0.2),
('avocado', 5, 0.2), ('cherry', 1, 20), ('grape', 1, 15), ('lemon', 5, 1)]
for item in new_items:
cart.add(*item)
while True:
print(cart)
try:
action = input('Add(A), Delete(D), Exit(E) :').strip().lower()
except:
continue
if action == 'a':
try:
item = input('Name of item: ').strip()
quantity = float(input('Quantiy: ').strip())
unit_price = float(input('Unit Price: ').strip())
except:
print('Wrong data for item !')
continue
cart.add(item, quantity, unit_price)
elif action == 'd':
key = input('Serial No. to be deleted: ').strip()
try:
key = int(key)
if key in cart.item_list:
cart.delete(int(key))
continue
except:
pass
print('Wrong serial No. !')
elif action == 'e':
break
else:
print('Wrong action !')
print('Bye !')
``

Return multiple values in a function

I am doing a University project to create a plan ordering ticket program, so far these are what I have done:
First, this is the function finding the seat type:
def choosingFare():
print("Please choose the type of fare. Fees are displayed below and are in addtion to the basic fare.")
print("Please note choosing Frugal fare means you will not be offered a seat choice, it will be assigned to the ticketholder at travel time.")
listofType = [""] * (3)
listofType[0] = "Business: +$275"
listofType[1] = "Economy: +$25"
listofType[2] = "Frugal: $0"
print("(0)Business +$275")
print("(1)Economy +$25")
print("(2)Frugal: $0")
type = int(input())
while type > 2:
print("Invalid choice, please try again")
type = int(input())
print("Your choosing type of fare is: " + listofType[type])
if type == 0:
price1 = 275
else:
if type == 1:
price1 = 25
else:
price1 = 0
return price1, listofType[type]
And this is a function finding the destination:
def destination():
print("Please choose a destination and trip length")
print("(money currency is in: Australian Dollars: AUD)")
print("Is this a Return trip(R) or One Way trip(O)?")
direction = input()
while direction != "R" and direction != "O":
print("Invalid, please choose again!")
direction = input()
print("Is this a Return trip(R) or One Way trip(O)?")
if direction == "O":
print("(0)Cairns oneway: $250")
print("(2)Sydney One Way: $420")
print("(4)Perth One Way: $510")
else:
print("(1)Cairns Return: $400")
print("(3)Sydney Return: $575")
print("(5)Perth Return: $700")
typeofTrip = [""] * (6)
typeofTrip[0] = "Cairns One Way: $250"
typeofTrip[1] = "Cairns Return: $400"
typeofTrip[2] = "Sydney One Way: $420"
typeofTrip[3] = "Sydney Return: $575"
typeofTrip[4] = "Perth One Way: $510"
typeofTrip[5] = "Perth Return: $700"
trip = int(input())
while trip > 5:
print("Invalid, please choose again")
trip = int(input())
if trip == 0:
price = 250
else:
if trip == 1:
price = 400
else:
if trip == 2:
price = 420
else:
if trip == 3:
price = 574
else:
if trip == 4:
price = 510
else:
price = 700
print("Your choice of destination and trip length is: " + typeofTrip[trip])
return price, typeofTrip[trip]
And this is the function calculating the total price:
def sumprice():
price = destination()
price1 = choosingFare()
price2 = choosingseat()
sumprice = price1 + price2 + price
print("How old is the person travelling?(Travellers under 16 years old will receive a 50% discount for the child fare.)")
age = float(input())
if age < 16 and age > 0:
sumprice = sumprice / 2
else:
sumprice = sumprice
return sumprice
The error I have:
line 163, in <module> main()
line 145, in main sumprice = sumprice()
line 124, in sumprice
sumprice = price1 + price2 + price
TypeError: can only concatenate tuple (not "int") to tuple
Can someone help me? I am really stuck.
I can't return all the
These functions return 2 values each: destination(), choosingFare(), choosingseat().
Returning multiple values at once returns a tuple of those values:
For example:
return price, typeofTrip[trip] # returns (price, typeofTrip[trip])
So while calculating the sum of all prices, you need to access price, price1, price2 from the tuples:
sumprice = price1[0] + price2[0] + price3[0]
Alternatively: You can edit the code to return list/ dictionary or some other data structure as per your convenience.
First let me explain what happends when you write. return price, typeofTrip[trip].
The above line will return a tuple of two values.
Now for sumprice I think what you want is sum of all prices. So you just want to sum first element of returned values.
This should work for your case.
sumprice = price1[0] + price2[0] + price3[0]

Existing dictionaries in list all being updated to new dictionary entry?

I am trying to create a simple program that contains a list of dictionaries. The grocery_history is the list of dictionaries, and the dictionary is grocery_item. Here is the code:
'''
The task is broken down into three sections.
Section 1 - User Input
Section 2 - loop through the grocery list
Section 3 - provide output to the console
'''
grocery_item = {}
grocery_history = []
stop = 'go'
while stop != 'q':
item_name = input("Item name:\n")
quantity = int(input("Quantity purchased:\n"))
cost = float(input("Price per item:\n"))
grocery_item['name'] = item_name
grocery_item['number'] = quantity
grocery_item['price'] = cost
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n")
print(grocery_history)
grand_total = 0
for grocery_item in range(0, len(grocery_history)):
item_total = grocery_history[grocery_item]['number'] * grocery_history[grocery_item]['price']
grand_total += item_total
print(str(grocery_history[grocery_item]['number']) + " " + grocery_history[grocery_item]['name'] + " # $%.2f" % grocery_history[grocery_item]['price'] + " ea \t$%.2f" % item_total)
item_total = 0.0
print("Grand total: $%.2f" % grand_total)
print(grocery_history)
In case you're wondering, the prompt for this assignment told me to use the variable grocery_item in my for loop. I normally would have chosen a different name since it becomes confusing. I also added a couple of print statements to print out the contents of grocery_history to see what's going wrong, and I confirmed it's when the dictionary is being added to the grocery_history list, that's when it for some reason updates existing dictionary items to match the new one being added. I can't figure out what I'm doing wrong. Any help would be greatly appreciated!
You need to define a new dictionary object each time in loop or else you end up using the same dictionary object so in effect replaces the already added one.
while stop != 'q':
grocery_item = {}
# ...
sample code should work
grocery_history = []
stop = 'go'
while stop != 'q':
item_name = input("Item name:\n")
quantity = int(input("Quantity purchased:\n"))
cost = float(input("Price per item:\n"))
grocery_item = {}
grocery_item['name'] = item_name
grocery_item['number'] = quantity
grocery_item['price'] = cost
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n")
print(grocery_history)
grand_total = 0
for grocery_item in range(0, len(grocery_history)):
item_total = grocery_history[grocery_item]['number'] * grocery_history[grocery_item]['price']
grand_total += item_total
print(str(grocery_history[grocery_item]['number']) + " " + grocery_history[grocery_item]['name'] + " # $%.2f" % grocery_history[grocery_item]['price'] + " ea \t$%.2f" % item_total)
item_total = 0.0
print("Grand total: $%.2f" % grand_total)
print(grocery_history)
the problem happened because you are repeating using same dict, although it adds to list each time, what you actually doing is keep updating the same reference so all content in the list becomes the same value
move dict inside solve the problem
This is because your loop does not create a new grocery_item object each time; it just updates the same grocery_item object over and over.
grocery_history ends up containing multiple references to this single object, in its latest state.
To fix this issue, move the line grocery_item = {} to be the first item underneath the while stop != 'q': loop. This will create a new object each time through the loop.
You can use map and sum to get grand_total
grocery_history = []
stop = 'go'
while stop != 'q':
grocery_item = {}
grocery_item['name'] = input("Item name:\n")
grocery_item['number'] = int(input("Quantity purchased:\n"))
grocery_item['price'] = float(input("Price per item:\n"))
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n")
grand_total = sum(map(lambda item: item['number'] * item['price'], grocery_history))
print("Grand total: $%.2f" % grand_total)
print(grocery_history)
Input:
Item name:
item
Quantity purchased:
2
Price per item:
1.2
Would you like to enter another item?
Type 'c' for continue or 'q' to quit:
q
Output:
Grand total: $2.40
[{'name': 'item', 'number': 2, 'price': 1.2}]

Dictionary value "not defined" Python

I'm working on a simple grocery list for class. In the first step we create an empty dictionary and list to be filled by input from a user. All grocery items go into a dictionary (grocery_item{}) and all of the dictionaries are to be added to the list (grocery_history).
My script currently looks like this:
grocery_item = {}
grocery_history = []
stop = 'go'
while stop == 'go' or stop == 'c':
item_name = input("Item name: \n" )
quantitiy = int(input("Quantitiy purchased:\n" ))
cost = float(input("Price per item:\n" ))
grocery_item.update({'name' : item_name, 'number' : quantitiy, 'price' :
cost})
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\n Type 'c' for continue
or 'q' to quite:\n")
If I print grocery_history at this point, it will print the list of dictionaries exactly as I intended. In the next step of the grocery list, we are trying to find the grand total of the items. However, whenever I try to find each items individual value, using for loops to get to each dictionary in the list, I receive an error claiming that keys are not defined, even though it just printed the dictionary entry for that grocery item, and all of the keys had values.
My script for this section looks like this:
grand_total = 0
for item in grocery_history:
I = 0
for price in item:
item_total = number * price
grand_total += item_total
print(number + name + '#' + '$' + price + 'ea' + '$' + round(item_total,2))
item_total = 0
I += 1
print('$' + round(grand_total,2))
The error is for the line in which I am trying to find the item_total, because it is the first line I try to use one of the keys. I have tried to rewrite the keys as grocery_item(numbers)/grocery_item(price), and receive the same error message.
I appreciate any help, and thanks in advance!
Try something like this:
grocery_history = []
stop = 'go'
while stop == 'go' or stop == 'c':
grocery_item = {}
grocery_item['name'] = input("Item name: \n" )
grocery_item['number'] = int(input("Quantitiy purchased:\n" ))
grocery_item['price'] = float(input("Price per item:\n" ))
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\n Type 'c' for continue or 'q' to quit:\n")
grand_total = 0
for item in grocery_history:
item_total = 0
item_total = item['number'] * item['price']
grand_total += item_total
print(item['number'], item['name'], '#', '$', item['price'], 'ea', '$', round(item_total,2))
print('$', round(grand_total,2))
If you want to use a for loop on a dictionary you will need to loop over the keys of the dictionary. You can do that by using .keys() or .items() functions of a dict. But as you see above, there is no need to loop over the dict keys in your code.
grocery_item = {}
grocery_history = []
stop = 'go'
while stop == 'go' or stop == 'c':
item_name = input("Item name: \n" )
quantitiy = int(input("Quantitiy purchased:\n" ))
cost = float(input("Price per item:\n" ))
grocery_item.update({'name' : item_name, 'number' : quantitiy, 'price' :
cost})
grocery_history.append(grocery_item)
stop = input("Would you like to enter another item?\n Type 'c' for continue or 'q' to quit:\n")
grand_total = 0
for item in grocery_history:
item_total = item['number'] * item['price']
grand_total += float(item_total)
print(str(item['number']) + " " + str(item['name']) + ' # ' + '$' + str(item['price']) + 'ea' + "\n" + '$' + str(round(item_total,2)))
item_total = 0
print("\n" + '$' + str(round(grand_total,2)) + " is the grand total.")

overlapping variable doesn't change variable

I can't even explain. Here is my code
foods = {12345670 : 'orange(s)',
87654325 : 'pineapple(s)'}
loop = 10
while loop == 10:
full_list = input("Type: ")
if full_list == 'end':
break
amount = int(input("Amount: "))
subtotal = 0
item = int(full_list)
if item in foods:
print("That would be {} {}".format(amount, foods[item]))
if full_list == '12345670':
price = (0.50 * amount)
print("Added Orange(s)")
print("Added "+str(price))
subtotal = subtotal + price
if full_list == '87654325':
price = (1.00 * amount)
subtotal = subtotal + price
print("Added Pineapple(s)")
print("Added "+str(price))
print("Your subtotal is " +str(subtotal))
I'm trying to get my subtotal to change accordingly to what the user purchases, I haven't finished making my list of purchasable items and so I don't want to change the name of the variable every time. What is the problem here? Why doesn't the variable subtotal change?
foods = {12345670 : 'orange(s)',
87654325 : 'pineapple(s)'}
loop = 10
subtotal = 0 # <------ moved it outside of the while loop
while loop == 10:
full_list = input("Type: ")
if full_list == 'end':
break
amount = int(input("Amount: "))
item = int(full_list)
if item in foods:
print("That would be {} {}".format(amount, foods[item]))
if full_list == '12345670':
price = (0.50 * amount)
print("Added Orange(s)")
print("Added "+str(price))
subtotal = subtotal + price
if full_list == '87654325': #should be an elif not an if
price = (1.00 * amount)
subtotal = subtotal + price
print("Added Pineapple(s)")
print("Added "+str(price))
print("Your subtotal is " +str(subtotal))
Every time you looped you restarted the total cost to 0 and it only kept the latest price. Move it outside of the while loop where I commented and you should be fine. Also use elif if you want to chain similar if statements together.
You have the following
if full_list == '12345670'
But it will never enter this if statement because your input type is an integer not a string. Do this without the single quotes instead:
if full_list == 12345670

Categories