-3

This is what I am trying to code: ask the user to deposit an amount of money of at least $20 to open the shopper card. The store will then give the first-time bonus of $10 to spend on items. The program will total the amount and generate the balance. If the amount originally deposited is less than $20, the customer will be told that the amount is too little to open the account (use of conditional expression). If the amount is greater than or equal to $20, then $10 will be added, and the total amount on the shopper card will be displayed. So far I have done this much but have gotten stuck.

print ('''Hi my name is Richard. Welcome to Buymore.''')
user = input( 'First name : ')
user = input( 'Last name : ')
user = input('ZIP code : ')

print ("Please deposit$20 into your account for your new shopper's card.")

user=input('20 dollars : ')
if num <20:
    print ("Congratulation’s on opening your new card")
    print ("As a gift we are giving you 10 dollars towards your first purchase")
if num >20 :    
    print('Need to deposit more minimum is 20 dollars')
DYZ
  • 55,249
  • 10
  • 64
  • 93
  • What is your question? (This is a Q&A site.) – DYZ Jan 28 '17 at 22:11
  • `input()` returns a string and you are comparing that with an integer. See the duplicate. In future, please include the input you gave, the full output of the traceback you got, as well as the expected output. – Martijn Pieters Jan 28 '17 at 22:12
  • Also, the title of your question doesn't tell us anything what you are asking about. You already have the `python` tag, so we already know what language your question is about without the title. – Martijn Pieters Jan 28 '17 at 22:13
  • 2 Errors you should note: 1. The `user` variable is used several times and you are not really saving the data inputed by the user. 2. The `user` variable will be a string since it is an input from the user. You can cast it to a number using `int(user)`. Try making your code more understandable and use explicit names for your variables. – Ofer Arial Jan 28 '17 at 22:14
  • I am not sure how to do < > a number like deposit $20 and if $18 is deposited it lets them know they need to deposit more but if they deposit $20 or more it says congratulations on opening your new account and any amount over $20 is added to their balance. – Richard Keiffer Jan 28 '17 at 22:17
  • ok sorry, I am new to this site. – Richard Keiffer Jan 28 '17 at 22:19

1 Answers1

0

Stuck at what level? What is working and was isn't?

From looking at your code, the condition should be reversed.

if num >= 20:
  # this is ok,  give bonus. 
else :
  #give error 

The user input should be retrieved in a num variable, and converted to an integer.

int(num)

retrieving the user information like you do is useless since you overwrite the name with the zip code, get them in separate variables.

Amaranth
  • 2,433
  • 6
  • 36
  • 58