All Questions
9 questions
0
votes
1
answer
118
views
Credit Card Check
So I am on pset6 trying to implement the credit card check.
I've already completed working through the numbers and am not having any issue with the actual algorithm.
But for some reason my if ...
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
79
views
pset6 credit the sum is not end with zero and check count right how
the Luhn’s Algorithm in 378282246310005 = 48 and in 371449635398431 = 76 so how not INVALID
it must end with zero so the two number must be INVALID
1
vote
1
answer
2k
views
Pset6 credit python Problem
I try to convert my Credit Solution from C to Python now.
But on Line 19 ( doubleCheck = ccNumber[i] * 2 ) i always get the error "TypeError: 'int' object is not subscriptable"!
How can i fix this?
...
0
votes
1
answer
180
views
Credit.py Invalid Error
For Pset6 Sentimental/Credit, my code keeps showing a result of INVALID\n no matter what is passed in. Debug50 is not working in Python, so I was not able to work through the lines one by one. Any ...
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?
0
votes
1
answer
374
views
pset6 credit.py returns INVALID for correct card number
When I input a valid credit card number, my code returns INVALID. I'm not sure about where did I go wrong in my code despite analysing it for hours. I would appreciate any help with this. Thank you :)
...
0
votes
1
answer
178
views
What's wrong with this luhn's algorithm? Python
s=cs50.get_string()
luhn=0
n=len(s)
for i in range(-1,-n-1,-1):
if i%2==0:
if 2*ord(s[i])>9:
luhn+=2*ord(s[i])-9
else:
luhn+=2*ord(s[i])
else:
...