Skip to content

Instantly share code, notes, and snippets.

View huzefamehidpurwala's full-sized avatar
🎯
Focusing

Huzefa Mehidpurwala huzefamehidpurwala

🎯
Focusing
View GitHub Profile
import javax.swing.*;
public class NumberGuessing {
public static void main(String[] args) {
int computeNumber = (int) (Math.random() * 100 + 1);
int userAnswer = 0;
int count = 1;
try {
while (userAnswer != computeNumber) {
String response = JOptionPane.showInputDialog(null, "Enter a guess between 1 and 100");
import java.util.Scanner;
class BankAccount {
int balance;
int prevTransaction;
String customerName;
String customerId;
int flag = 0;
BankAccount(String cName, String cId) {
@huzefamehidpurwala
huzefamehidpurwala / convert_roman_to_int.py
Created December 4, 2022 02:54
I have written a Python Program to convert a Roman Formatted Number, like MCDLIX, to an Integer Formatted Number, i.e. equals to 1459.
roman = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000,'IV':4,'IX':9,'XL':40,'XC':90,'CD':400,'CM':900}
def roman_to_int(s):
i = 0
num = 0
while i < len(s):
if i+1<len(s) and s[i:i+2] in roman:
num += roman[s[i:i+2]]
i+=2
@huzefamehidpurwala
huzefamehidpurwala / sorting-strings.py
Created December 4, 2022 02:55
This Program sorts a string with lower-case letters before upper-case letter before numerical digits before other special characters
# github -> https://github.com/huzefamehidpurwala/Sorting-String-Python.git
s = input() # the alphanumeric string to be sorted
# defining empty lists to bifercate every index of the string respectively
strl_lst = []
stru_lst = []
num_lst = []
extra_lst = []
@huzefamehidpurwala
huzefamehidpurwala / rand-pass.py
Last active June 12, 2023 05:19
Advanced Strong Password Generator
from sys import argv # to take length of the password from the user from the cli command itself
from random import choice # to select random elements from an iterable
from string import ascii_letters, punctuation, digits # string of characters, special_chars and digits
# from os import system
def makepass(x, pas="") -> str:
assert x > 5, "Length of Password should be greater than 8"
x = x - len(pas)
@huzefamehidpurwala
huzefamehidpurwala / excel-xlsx-handling.py
Created January 16, 2023 09:38
Create and append data to a xlsx file using openpyxl module.
from time import sleep
import openpyxl
from datetime import datetime
print("Welcome!\nWe are working...!")
# Get the current date and time
now = datetime.now()
worksheet_title = now.strftime("%Y-%m-%d") # for time %H-%M-%S
@huzefamehidpurwala
huzefamehidpurwala / amzn-coupon.py
Created January 22, 2023 04:49
This python script works as a robot which takes 'product asins' stored in a text file in the same directory with the name 'asins.txt' and enters and select the specified product for coupon activation on Amazon SellerCenter.
import pyautogui
import time
with open("asin.txt", "r") as asins:
time.sleep(3)
for line in asins.readlines():
pyautogui.typewrite(line)
@huzefamehidpurwala
huzefamehidpurwala / amzn-keywords.py
Created January 22, 2023 05:22
This python script takes a string of all related kewords and returns a non repeating keyword string to clipboard.
from os import system
system("cls")
flag = True
while flag:
string = input("Enter the words: ").split()
system("cls")
if not string:
from string import whitespace, punctuation, digits, ascii_lowercase as letters
# from enchant import Dict
from requests import get
dic1 = dict()
dic2 = dict()
for i, l in enumerate(letters):
dic1.update({l.lower(): i})
dic1.update({i: l.upper()})
dic2.update({l.upper(): i})
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BollywoodGame
{
internal class Program
{