Python Forum
Unit 18 Procedural Programming Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unit 18 Procedural Programming Python
#1
import random         #this is to import the random number for calculations
initialBalance = 10000  #this is the initial balance £1000
wholeSalePrice = 40    #this is the wholesale price
shopSalePrice = 80    #shops sells the product for £40
days = 0                #days end at 0 
newBalance = 250

#procedures

import random

initialBalance = 10000
randomNumber = random.randint(1,50)

def costs (wholeSalePrice,productPurchased):
    calculations = wholeSalePrice*productPurchased #this is to calculte the wholeslae price by the product purchased price
    print (calculations)
    return calculations

def calcNewBalance (initialBalance,addvertCost,productPurchased):  #this is to pass the calculations throgh the parameter
    answer = initialBalance-addvertCost-productPurchased*wholeSalePrice      #this is to output the new balnace after deducting the advertising cost and the product purchased cost from the new balnace  
    print (answer)
    return answer

def calpriceOfProduct (amount):
    priceOfProduct = amount #this is to calculte the wholeslae price by the product purchased price
    print (priceOfProduct)
    return priceOfProduct

def calshopPrice (amount):
    shopPrice = amount #this is to calculte the wholeslae price by the product purchased price
    print (shopPrice)
    return shopPrice

def calculateSalesFigures(salesFigures): #this is to generate a number to calculate sales on a daily basis
    sales = random.randint(1,50)
    print (sales)
    
    return sales

def expenses(everyDayExpenses): #this is to calculate the daily expenses 
    WholeSalePrice = 10
    stock = 20
    dailyExpenses = WholeSalePrice*stock    
    print (dailyExpenses)
    return dailyExpenses

def balanceUpdate(newBalance,salesFigure,dailyExpenses):
    updatedBalance = (newBalance + salesFigure - dailyExpenses)#this is the remaining balance after the daily expenses 
    print ("newbalance is £:" + str(updatedBalance))
    print (updatedBalance)
    return updatedBalance

#_________________________________________________________________________

#input

print("initial balance is £" + str (initialBalance))

advertisingCost = int(input("please enter a value for addvertcost £"))    #this inforamtion will be displayed for the user to insert the amount
productPurchased = int (input ("please enter the amount of products you wish to purchase for stock £"))  #this inforamtion will be displayed for the user to insert the amount
expenses = int(input("Please enter how much you want to spend on expenses £"))
priceOfProduct = int(input(" what is the price Of Product £"))
shopPrice = int(input(" what is the shopPrice £"))
sales = int(input(" what is the sales price £"))
print ("")

#_________________________________________________________________________
                        
#process

days = 30
randomNumber = random.randint(1,advertisingCost)
days = days - 1

while (days >0): and (newBalance >0): 
    if product purchased>0
    sales = random*advertisingCost
    productPurchased sold = sales//shopPrice
    
    print ("days" + str (days))   #this is the while statement for the loop
    
    
    if (productSold>productSold):
        lackOfStock = productSold - productPurchased
        lostProfit = lackOfStock*shopPrice#this is a block of code for If statement showing working out for handling products sold and in stock 
        sales = sales - lostProfit
        newBalance = newBalance-sales-expenses

         
        print ("newbalance is £:" + str(newBalance))
        print ("")
#_________________________________________________________________________
        
#output    

    if (newBalance <0): 
        print ("we need more stock")
    else:

        print("stock is fine") #this IF statement is to decide if the stock is okay or more stock is needed 



#costs = (wholeSalePrice,productPurchased) #these are the variables set for procedures 
#newBalance = calcNewBalance(newBalance,advertisingCost,productPurchased)
#salesFigure = calculateSalesFigures(0) 
#updatedBalances = balanceUpdate(newBalance,salesFigure,expenses)
Error:
invalid syntax
Reply


Messages In This Thread
Unit 18 Procedural Programming Python - by kanwal121 - Dec-21-2017, 05:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework Python unit test Paragoon2 4 1,528 Dec-12-2022, 12:45 PM
Last Post: Paragoon2
  Help with Unit Tests pdub787 3 3,068 Nov-20-2019, 07:45 PM
Last Post: ndc85430
  Verilog HDL Programming to Python Programming? noobcoder 1 3,039 Jul-18-2019, 09:28 PM
Last Post: nilamo
  unit 18 codes Miss_Kaur 7 5,035 Dec-19-2017, 02:49 PM
Last Post: sparkz_alot
  Unit 18: Procedural Programming Assignment (Shop Simulation) shaheduk323 28 13,440 Dec-17-2017, 08:31 PM
Last Post: Terafy
  Unit 18 Procedural Programming Python kanwal121 6 4,092 Dec-17-2017, 07:18 PM
Last Post: Terafy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020