Most popular tags

301 questions

410 answers


310 users

Most active Members
this week:

    whats wrong with my code. Invalid variable names.

    +1 vote
    10p =0.10
    20p = 0.20
    50p = 0.50
    1pound = 1


    10p = float(input("how many 10ps do you have"))
    20p = float(input("how many 20ps do you have"))
    50p = float(input("how many 50ps do you have"))
    1pound = float(input("how many 1pounds do you have"))


    print ("you have")
    print (10p + 20p + 50p + 1pound)
    asked Nov 13, 2016 in Python by 14scotta (300 points)

    1 Answer

    0 votes
    Variable names MUST start with a letter.  
    10p is an invalid variable name.  You could use pence_10 or value_10 or p10 instead.
    answered Nov 13, 2016 by smartin (16,520 points)
    Welcome to Selby Computing Q&A, where you can ask questions and receive answers from other students in Computer Science.