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 sys | |
def main(): | |
if len(sys.argv) == 2: | |
print(f"the program name is {sys.argv[0]}") | |
print(f"hello, {sys.argv[1]}") | |
for eachArg in sys.argv: | |
for eachChar in eachArg: | |
print(eachChar) |
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
# Print any number of question marks | |
def main(): | |
names = ['john', 'cassie', 'nori'] | |
for name in names: | |
print(f"{name}",end=" is awesome!") | |
print() | |
if __name__ == "__main__": |
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
# create a mario pyramid in python! | |
from cs50 import get_int | |
def main(): | |
# Prompt user for a positive number | |
while True: | |
n = get_int("enter a positive number: ") | |
if n > 0: |
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
from time import sleep | |
# Iteratively triple i | |
i = 1 | |
while True: | |
print(i) | |
i *= 3 | |
sleep(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
# get a positive integer from the user | |
from cs50 import get_int | |
def main(): | |
x = getPositiveInteger("Please enter a positive integer: ") | |
print(f"Thanks for entering {x}!") | |
''' | |
for validating user input the logic is |
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
from cs50 import get_int | |
def main(): | |
x = get_int("Give me a number please: ") | |
print( | |
f"{x} to the power of 5 equals " | |
f"{powerOfFive(x)}. Wow that is " | |
"probably a big number!") | |
def powerOfFive(x): |
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
from cs50 import get_string | |
c = get_string("enter Y or N if this is fun: ") | |
if c == "Y" or c == "y": | |
print("glad you are having fun") | |
if c == "N" or c == "n": | |
print("it gets better...") |
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
from cs50 import get_int | |
# get input from the user | |
x = get_int("x: ") | |
y = 42 | |
if x < y: | |
print("x is less than y") | |
elif x > y: |
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
from cs50 import get_int | |
# prompt the user for a number | |
x = get_int("Enter a number: ") | |
# perform arithmetic | |
#addition | |
print(f"{x} plus {x} is equal to {x + x}") | |
#subtraction | |
print(f"{x} minus {x} is equal to {x - x}") | |
#multiplication |
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
const puppeteer = require('puppeteer'); | |
const fs = require('fs'); | |
const HTMLParser = require('node-html-parser'); | |
const urls = ['https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-JetBlue', | |
'https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-or5-JetBlue#REVIEWS', | |
'https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-or10-JetBlue#REVIEWS', | |
'https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-or15-JetBlue#REVIEWS', | |
'https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-or20-JetBlue#REVIEWS', | |
'https://www.tripadvisor.com/Airline_Review-d8729099-Reviews-or25-JetBlue#REVIEWS', |