Questions tagged [credit.py]
The credit.py tag has no usage guidance.
10 questions
0
votes
1
answer
59
views
PSET 6 Credit More: always gives an output of INVALID
from cs50 import get_int, get_string
import sys
Prompt credit number input
cardnumber = get_int("Number : ")
#copying the credit card numbers into other variable / arrays
cardnumber
...
0
votes
1
answer
107
views
pset6 credit help with calculations in python
I am trying to convert my credit solution from C to python, but for some reason it is not working. Attached is my code and the problems
from cs50 import get_int
card, a, m, v = False, False, False, ...
0
votes
1
answer
75
views
PSET6 Credit - checksum not giving the correct number
list1 = list(input("Number: ").strip())
even_count, odd_count, count = 0, 0, 0
# if the length is even
if len(list1)%2 == 0:
# iterating each number in list
for num in list1:
...
0
votes
1
answer
84
views
Credit.py Runtime Errors
My code has multiple errors, according to the Python interpreter. This is strange as I have simply ported, line to line, from C to Python. Can someone please help me to understand why my code is ...
1
vote
1
answer
240
views
problem with pset6 python credit
Below is my code:
[hidden code]
output is:
Enter the card number: 378282246310005
firstTwo 37; firstOne 3; cardlen 15
MASTERCARD
note: it shows MASTERCARD instead of AmEx..Why?
1
vote
1
answer
587
views
PSET6 credit.py, not able to import 'get_long_long'
Traceback (most recent call last):
File "credit.py", line 1, in
from cs50 import get_long_long
ImportError: cannot import name 'get_long_long'
0
votes
1
answer
62
views
Pset6 Credit.py: Compiler returns 'Killed'
When I run my code through the compiler, it asks me for the credit card number. After I type in the number, there is a long pause after which the compiler returns 'Killed'. I looked this up online and ...
0
votes
0
answers
934
views
Pset6: Python how to extract a single number as int from a list of strings of numbers
i = 0
sum = 0
sum += number[i]
i += 2
It gives me this error:
'int' object is not subscriptable
Googled it. Don't understand.
What I want to do is add every other number in a credit card number, ...
0
votes
1
answer
313
views
Pset6 credit.py always outputs INVALID
I'm currently re-implementing every one of my projects that could be bettered before I submit them all. Right now, I'm stuck on my re-implementation of pset6 credit. For some reason, it always outputs ...
0
votes
1
answer
362
views
Credit.py Ternary operator
here's my code for credit.py. I feel as though it should be working as it validates my specific visa number, but won't validate the numbers that were provided by Check50 for the C problem. I feel as ...