lundi 24 octobre 2022

Python def function calling and random errors

I want to write a code that will display a warning msg that the user's data has been encrypted (ransomware msg). In the msg, the name of the victim must be randomly selected from a list of names I have generated, and the amount to be paid also the same (100 to 1000). I have written the code but it is not running. How do you call a function after it has been made? And does my random code have errors that keeps it from running?

import random
def ransom_msg (name,ransom_amount):

    #Defining list of target names
    name = ["Daily Deal Retail","Healthline Medical","True Banking","HR solutions",
                 "Crypto Me", "Total Privacy", "Pineapple State University"]

    #Assigning payment range for random selection between 100 and 1000$
    ransom_amount = random.radint(100,1000)

    victim_name = random.choice(name)
    print(victim_name)
    victim_payment = random.choice(ransom_amount)
    print(victim_payment)
    print("please",victim_name,"pay us",victim_payment,"asap! Or else, all your data is forever lost.")

ransom_msg(victim_name,victim_payment)



Aucun commentaire:

Enregistrer un commentaire