It is propably simple question.
I am making money system to my game.
I get syntax error after first else statement and dont understand why i get it.
Regards Loopaz
Code: Select all
init python:
from random import randint
wallets = (pockets, wallet_tiny, wallet_small, wallet_medium, wallet_big, wallet_huge)
banknotes = (500,200,100,50,20,10)
coins = (5,2,1,0.5,0.2,0.1)
shopping_list = []
class Money():
def __init__(self, account, amount, ):
self.account = account
self.wallet = []
self.amount = amount
wallet_size() = pockets
def wallet_size():
if wallet_size() is pockets:
max_banknotes = 50
max_coins = 50
# if self.player_luck == 0:
# lost = self.wallet.pop(self.wallet[randint(0,len(self.wallet))])
# cr "You have lost " + lost +" because lack of wallet"
elif wallet_size() is wallet_tiny:
max_banknotes = 10
max_coins = 10
elif wallet_size() is wallet_small:
max_banknotes = 15
max_coins = 10
elif wallet_size() is wallet_medium:
max_banknotes = 25
max_coins = 20
elif wallet_size() is wallet_big:
max_banknotes = 35
max_coins = 30
elif wallet_size() is wallet_huge:
max_banknotes = 45
max_coins = 45
else:
cr 'wallet_size error!'
def account_check():
return account
def wallet_check():
for count in self.wallet:
wallet_amount += count
return wallet_amount
def wallet_banknotes():
sort(self.wallet)
for banknote_amount in self.wallet:
while banknote_amount >= 10:
banknotes_amount += banknote_amount
return banknotes_amount
def wallet_coins():
sort(self.wallet)
for coin_amount in self.wallet:
while coin_amount < 10:
coins_amount += coin_amount
return coins_amount
def account_to_wallet(amount):
if amount % 10 == 0 and amount <= account and account >= 10 and banknotes_count <= max_banknotes:
for banknote_item in banknotes:
while amount >= banknote_item and account >= 10 and banknotes_count <= max_banknotes:
amount -= banknote_item
self.wallet.append(banknote_item)
account -= banknote_item
banknotes_count += 1
cr "Bankonotes amount in the wallet [banknotes_count]"
cr "Amount money in the wallet" + wallet_check()
bank "Your account " + account_check()
cr "Money amount in the wallet" + wallet_amount =
elif amount % 10 != 0:
bank "The amount of whitdraft is not a multiplication of 10"
elif account < 10:
bank "You dont have enough money to make transaction"
elif banknotes_count < max_banknotes:
cr "The amount of banknotes will not fit to this wallet"
elif amount > account:
bank "You don't have this amount on your account. The amount is too high"
else:
cr "amount_to_wallet error!"
def wallet_to_account(amount):
if amount % 10 == 0 and amount <= wallet_banknotes():
for banknote_item in banknotes:
while amount >= self.wallet and self.wallet >= 10 and amount <= wallet_banknotes():
amount -= banknote_item
self.wallet.remove(banknote_item)
account += banknote_item
banknotes_count -= 1
elif amount > wallet_banknotes():
cr "You don't have soo much in wallet"
elif amount % 10 != 0:
bank "Amount must be an multiplication of 10"
else:
cr " wallet_to_account error! "
def full_cost():
# for price in shopping_list_prices()
# full_price += price
pass
def shopping_list_prices():
# for item in shopping_list:
pass