Fraud Checker Program in Python

Rohan is a cheater who created a function to print multiplication tables for input numbers. We created a function that validates Rohan tables and tells whether Rohan is a fraud or not. Enjoy!

# FRAUD Checker: This program checks whether Rohan Das is a fraud or not.
# whether Rohan Das function returns the multiplication tables correctly or not
import random
def rohanTables(n):
    tabletList = []
    for i in range(1, 11):
        randomNumber = random.randint(3,9)
        if i == randomNumber:
            result=(randomNumber*n) + random.randint(1, 4)
        else:
            result=i*n
        tabletList.append(result)
    return tabletList

def validateRohandTables(n):
    tabletList = []
    for i in range(1, 11):
        result=i*n
        tabletList.append(result)
    return tabletList
    
whichTable = int(input("Which table do you want: "))

conclusions = []
for i in range(5):
    r = rohanTables(whichTable)
    print(r)
    v = validateRohandTables(whichTable)
    print(v)

    if r == v:
        conclusions.append(0)
        print("Tentatively, Rohan is NOT a fraud.")
    else:
        conclusions.append(1)
        print("Tentatively, Rohan is a FRAUD.")

# print(conclusions)

if 1 in conclusions:
    print("\nFinal Conclusion: Rohan Das is a FRAUD.\n")
else:
    print("\nCheck again! Rohan Das might be a fraud.\n")
    
print("The true result btw is", v,"\n")

Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes