Advertisement
Guest User

new

a guest
Jan 11th, 2019
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #pylint:disable=W0621
  2. #pylint:disable=W0312
  3.    
  4. balance = 100
  5. addCredit = input("How much credit do you want to add?\n")
  6. addCredit = int(addCredit)
  7.  
  8. def Credit():
  9.     global updatedCredit
  10.    
  11.     updatedCredit = balance + addCredit
  12.  # I know it will work if added below the var: addCredit,
  13.  # but its not always possible in long functions.
  14.     return updatedCredit
  15.  
  16. Credit()
  17.  
  18. ### either print... ### doesnt work without global
  19. print(updatedCredit, "SUCCESS")
  20.  
  21. ### or use in a new function.. ### Doesnt work without global either.
  22. def loanCredit():
  23.     if updatedCredit < 200:
  24.         updatedCredit =+ 200
  25.     else:
  26.         return
  27.  
  28. print(updatedCredit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement