PW Akshay

Generation

generate functionMon, 28 Nov 2022

import random from string import * constants = ascii_letters + digits + punctuation print(constants) password_length = int(input("What's the length of the password? ")) password = "" for i in range(password_length): password += random.choice(constants) print(password) # do not close the above program after execution rather rerun it

print("Hello") user_input = input("what is your name") print("Hello," + user_input) # to convert the input to int a = int(input("give me a number")) b = int(input("give me another number")) print(a + b) # calling a function a = 5 b = 4 def add(a, b): return a + b result = add(a, b) print(result) # you can also do this print(add(a, b)) # putting this to use def add(a, b): return a + b def subtract(a, b): return a - b def multiply(a, b): return a * b def divide(a, b): return a / b print(add(1, 2)) print(subtract(1, 2)) print(multiply(1, 2)) print(divide(1, 2))

Questions about programming?Chat with your personal AI assistant