This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
NewerOlder