Skip to content

Instantly share code, notes, and snippets.

View sshehrozali's full-sized avatar
🌍

Shehroz Ali sshehrozali

🌍
View GitHub Profile
@sshehrozali
sshehrozali / divisible_check.py
Created December 15, 2020 12:41
Python function to print all numbers that are divisible by 2 or 3
# Function to print divisibles of 2 or 3
def even(n):
if n == 2:
print(n)
exit(0)
# Initiliaze counters
prime_counter = 0
check = 0
@sshehrozali
sshehrozali / exam.py
Created December 30, 2020 08:21
Solution for given Question in paper.
# Dictionary
dic = {"SECP": "Securities and Exchange Commission Pakistan", "SBP": "State Bank of Pakistan", "FBR": "Federal Board of Revenue", "PCB": "Pakistan Cricket Board", "ISPR": "Inter Services Public Relations"}
# Open file in read mode
fp = open("Lab 8/20B - 084 - SE.txt", "r")
# Empty list to store list of lines
lst_lines = []
# Get each line of file
@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;
@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 / 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 / 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
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
# 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 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)
@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