asked 52.3k views
1 vote
Write an expression that will print "dollar or more" if the value of numcents is at least a dollar (100 cents is a dollar). ex: if numcents is 109, output is "dollar or more".

2 Answers

7 votes
Im not sure what you mean by that?

answered
User Tony Evyght
by
9.0k points
6 votes

Answer:

num_cents = 109

if (num_cents >= 100):

print('Dollar or more')

else:

print('not a dollar')

Step-by-step explanation:

simple solution/explanation

100 cents equals to 1 dollar, if there are 100 cents or more

print Dollars or more

Otherwise print not a dollar if there's less than 100 cents.

In this case we have 109 cents which is 1 dollar and 9 cents.

You could add an extra else if statement if more conditions are needed for different amounts; however the code above will make sure you pass the 'test' if you are learning this through zybooks.

answered
User Joshua DeWald
by
8.1k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.

Categories