Apr-02-2021, 08:16 PM
(This post was last modified: Apr-02-2021, 09:57 PM by snippsat.
Edit Reason: Added code tag
)
This is my first semi-professional project in Python. And I'm in trouble.
Python does not understand the again function. This means that when you press button 2, Python executes the second function and after finish it, python do that function agin.
Can anyone help me solve this problem?
This is my code :
Python does not understand the again function. This means that when you press button 2, Python executes the second function and after finish it, python do that function agin.
Can anyone help me solve this problem?
This is my code :
import subprocess #do it again def again(): again_v = input('For Menu type (M) for Exit type (E) : ') if again_v.upper() == 'M': start() elif again_v.upper() == 'E': print('Good Luck !') else: again() #create username and password def creat_user(): user = input('Enter your Username : ') Pass = input('Enter your Password : ') userpass = subprocess.check_output('net user {} {} /add' . format(user,Pass) , shell=True) adm = subprocess.check_output('net localgroup administrators {} /add' . format(user) , shell=True) #give administrator to user print('Done !') #change password def ch_pass(): u = input('Ok, Enter your Username : ') p = input('Now, Enter your new Password : ') u_p = subprocess.check_output('net user {} {}' . format(u,p) , shell=True) print('Action completed !') def start(): a = input(''' Welcome, [+] (1) Create new user [+] (2) Change your password what do you want to do? : ''') a = int(a) if a == 1: creat_user() elif a == 2: ch_pass() creat_user() again() ch_pass() again() start()