Skip to content

Instantly share code, notes, and snippets.

View sshehrozali's full-sized avatar
🌍

Shehroz Ali sshehrozali

🌍
View GitHub Profile
@sshehrozali
sshehrozali / extendingArray.java
Created May 17, 2023 16:44
Java code to (mimic) extending the array (v1)
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
// Q.
// Take 10 integer inputs from user and store them in
// an array. Now, copy all the elements in
// an another array but in reverse order.
@sshehrozali
sshehrozali / arrays.java
Created April 18, 2023 17:19
Working with Arrays in Java
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
// Q. Take 5 integer inputs from user and store them in an array and print them on screen.
// Created an array of Integers
ArrayList<Integer> numbers = new ArrayList<>();
// Stored data in array
@sshehrozali
sshehrozali / gist:fe84d2bdbed83dc8bd3c216decf792ee
Created June 27, 2022 16:43
the-most-fancy-looking-advanced-phonebook-never-made-app
# 1st Project
# Phonebook that can:
# 1. Read all contacts
# 2. Create contacts
# Welcome to Phonebook App
# 1. Create new contact
# 2. Read contacts
# Type option: 1
# I want to build a program that will forever ask me to enter number
while True:
# DO WHATEVER
name = input("Enter something: ")
# Exit the program when user enters shehroz
if name == "abc":
break
print(name)
# Goal: We want to build a phonebook application
# Features: 1. Creating a Contact 2. Viewing all the Contacts
phonebook = [] # Empty list of Phonebook
saved = int(input("How many contacts you want to store? "))
print() # New-line
# I am storing 3 contacts inside my Phonebook
for i in range(saved):
i = 0
# DO NOT TOUCH HERE #
# DO NOT TOUCH HERE #
phonebook_names = ["emma", "aly", "jackson"]
phonebook_numbers = ["455-111-222", "455-666-888", "455-333-555", "455-333-871"]
# DO NOT TOUCH ABOVE THIS LINE #
# DO NOT TOUCH ABOVE THIS LINE #
# We are actually printing names with their numbers
@sshehrozali
sshehrozali / phonebook.py
Created May 23, 2022 16:33
Empty phonebook program
# MY JOB
# is basically to print all contacts of phonebook on screen
# Its list of contacts // phonebook
phonebook = []
i = 0 # We are initialization a counter
while i == len(phonebook):
print(f"Contact no. {i + 1}:\t\t {phonebook[i]}")
i = i + 1 # STEPS to increase
@sshehrozali
sshehrozali / uncompleted-while-loop.py
Created May 13, 2022 16:07
uncompleted-while-loop
i = 0 # for Parent While Loop
j = 0 # for Child Loop
counter = 10 # DON'T TOUCH IT (constant)
# What's the Output?
# Hello Cat!
# Hello Cat!
# Hello Cat!
# Hello Cat!
@sshehrozali
sshehrozali / arcadegame.py
Created May 9, 2022 16:33
Arcade Machine that takes Token and runs the game
# Question?
# What we need to build?
# 2 tokens -> Play game 2x
# 5 tokens -> Play game 5x
# 6 tokens -> PLay game 6x
# 10 tokens -> Play game 10x
# This token we will be provided by user
token = eval(input("Enter Your Token Please: ")) # Evaluating the incoming value to its respective Data type
@sshehrozali
sshehrozali / problem.js
Created April 17, 2022 09:50
Coding problem given to me during my Technical Round @munchies, Pakistan
// Given an array of numbers, check if sum of two equals to target or not
// Example [4, 7, 8, 9], target = 11
// True
// Array of sequence number n
let array = [4, 7, 8, 9];
// Constant Target to find
const target = 11;