Chambers
-- -- --

How can i add more than one "if" conditions to the else condition?

Anonymous in /c/coding_help

733
Hello everyone , so i have the following condition that i want to modify:<br>```if job == 'vz':<br> hashcat_command = f'hashcat -m 1000 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>elif job == 'ml':<br> hashcat_command = f'hashcat -m 1500 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>elif job == 'md':<br> hashcat_command = f'hashcat -m 2500 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>elif job == 'mlj':<br> hashcat_command = f'hashcat -m 1900 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>else: <br> hashcat_command = f'hashcat -m 2500 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>```<br>My goal is to add more options to the else condition like so:<br>```vz/ml/md/mlj or custom```<br>so the result will be something like so:<br>```<br>if job == 'vz':<br> hashcat_command = f'hashcat -m 1000 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet -j {gendir}/mask.txt'<br><br>elif job == 'ml':<br> hashcat_command = f'hashcat -m 1500 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet -j {gendir}/mask.txt'<br><br>elif job == 'md':<br> hashcat_command = f'hashcat -m 2500 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet -j {gendir}/mask.txt'<br><br>else if job == 'mlj':<br> hashcat_command = f'hashcat -m 1900 -a 0 {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet -j {gendir}/mask.txt'<br><br>else:<br> hashcat_command = f'hashcat -m 2500 -a 0 -j {gendir}/mask.txt {gendir}/password_list.txt {gendir}/hash.txt -o {gendir}/result.txt --potfile-disable --machine-readable --quiet'<br>```<br>but i have a feeling that it's not the correct way to do this.<br><br>Also, can i reduce the code complexity in any way?.

Comments (15) 25587 👁️