Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Multiplify's user avatar
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, ...
Bob Tan's user avatar
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? ...
user avatar
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?
RavanaNiK's user avatar
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 :) ...
Prav Elan's user avatar
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: ...
Vaish MK's user avatar
  • 167