player ={
# "key": "value"
"name": "nico",
"age": 22,
"alive": True,
# if you need a list, then do a list inside the dictionary
"fav_food": ("burger","pizza"),
"friend": {
"name": "lynn",
"age": 23,
"fav_food": ["apple","pizza"]
}
}
player["friend"]["fav_food"].append("apple")
# dict안에는 항상 브라켓으로 불러줌
print(player["friend"])
players ={
"name": "nico",
"age": 22,
"alive": True,
# if you need a list, then do a list inside the dictionary
"fav_food": ["burger","pizza"]
}
players["fav_food"].append("32")
print(players["fav_food"])
print(players.get("fav_food"))
players ={
"name": "nico",
"age": 22,
"alive": True,
# if you need a list, then do a list inside the dictionary
"fav_food": ["burger","pizza"]
}
print(players)
print(players.get("age"))
print(players.get("fav_food"))
# array는 똑같이 프린트할때 해줌
print(players['fav_food'])
players.pop("age")
print(players)
# 브라켓 밖에서는 =을 쓰고 안에서는 :을 씀!
players['xp'] = 1500
print(players)
# tuples are not mutable, but indexes also works
days = ("mon","tues","wed")
days_of_week = ["mon", "tue", "wed", "thur", "fri"]
print(days[0])
print(days_of_week[2])
players ={
"name": "nico",
"age": 22,
"alive": True,
# if you need a list, then do a list inside the dictionary
"fav_food": ["burger","pizza"]
}
print(players)
print(players.get("age"))
print(players.get("fav_food"))
# array는 똑같이 프린트할때 해줌
print(players['fav_food'])
players.pop("age")
print(players)
# 브라켓 밖에서는 =을 쓰고 안에서는 :을 씀!
players['xp'] = 1500
print(players)from random import randint
pc_choice=randint(0,5)
playing = True
while playing:
user_number = int(input("number:"))
if user_number == pc_choice:
print("won")
playing = False
elif user_number> pc_choice:
print("go lower")
elif user_number<pc_choice:
print("go higher")
# input will take only one argument
# if you need an integer, then you would have to put int(()) to make the input answer to integer
age = int(input("how old are you?"))
if age<18:
print("ok")
elif age>18:
print("no")
# def make_juice(fruit):
# # return function will end everything
# return f"{fruit}+juice"
# def add_ice(juice):
# return f"{juice}+ice"
# def add_sugar(sugar):
# return f"{sugar}+sugar"
# mango = make_juice("mango")
# iced_mangoJuice= add_ice(mango)
# final_juice= add_sugar(iced_mangoJuice)
# print(final_juice)
# def tax_calc(money):
# return (money*0.3)
# c= tax_calc(3000)
# def pay_tax(mon):
# print("thank you for", mon)
# pay_tax(c)
# (username)은 parameter임
# def say_hello(username, userage):
# print("hello", username, "and I am", userage, "years old")
# # function을 실행하려면 curly bracket밖에서부터 진행해야 됨
# say_hello("nick",12)
# from requests import get
# from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
# from extractor.wwr import extract_wwr_jobs
# from bs4 import BeautifulSoup
# options = Options()
# options.add_argument("--no-sandbox")
# options.add_argument("--disable-dev-shm-usage")
# browser = webdriver.Chrome(options=options)
# def get_page_count(keyword):
# base_url = "https://kr.indeed.com/jobs?q="
# end_url = "&limit=50"
# browser.get(f"{base_url}{keyword}{end_url}")
# soup = BeautifulSoup(browser.page_source, "html.parser")
# pagination = soup.find("nav", class_="ecydgvn0")
# if pagination == None:
# return 1
# pages = pagination.find_all("div", recursive=False)
# count = len(pages)
# if count >= 5:
# return 5
# else:
# return count
# print(get_page_count("python"))
# def extract_indeed_jobs(keyword):
# base_url = "https://kr.indeed.com/jobs?q="
# end_url = "&limit=50"
# browser.get(f"{base_url}{keyword}{end_url}")
# results = []
# soup = BeautifulSoup(browser.page_source, "html.parser")
# job_list = soup.find("ul", class_="jobsearch-ResultsList")
# jobs = job_list.find_all('li', recursive=False)
# for job in jobs:
# zone = job.find("div", class_="mosaic-zone")
# if zone == None:
# anchor = job.select_one("h2 a")
# title = anchor['aria-label']
# link = anchor['href']
# company = job.find("span", class_="companyName")
# location = job.find("div", class_="companyLocation")
# job_data = {
# 'link': f"http://kr.indeed.com{link}",
# 'company': company.string,
# 'location': location.string,
# 'position': title
# }
# results.append(job_data)
# for result in results:
# print(result, "\n//////////\n")
'Programming > HCJ(html_css_javascript)' 카테고리의 다른 글
[Javascript] Day 20 (0) | 2023.02.27 |
---|---|
[javascript] Day 19 (0) | 2023.02.27 |
[html_css] Day 12 (0) | 2023.02.18 |
[html_css] Day 11 (0) | 2023.02.16 |
html+css로 카카오톡 채팅 페이지 까지 모든 페이지 완성해보기 (0) | 2023.02.14 |