Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

JINIers

[Python 100 day challenge ] Day 1 본문

공부/Python

[Python 100 day challenge ] Day 1

JINIers 2024. 3. 15. 10:02

맨날 코드공부 해야지 하고 책도 사놓고 이것저것 보면서 혼자 깔짝거리다가 도저히 안되겠다 싶어서

유데미에 있는 엄청엄청 유명한 안젤라님의 파이썬 100일 부트캠프를 결제함

혼자서 하려고 해도 아예 기초,기본이 없다보니 너무 어려웠다.

그래서 전세계적으로 사람들이 많이 듣는 영상을 결제했는데 생각보다 너무 쉽고 재밌게 설명해주심!

이해도 쏙쏙 잘된다.

그래서 day 한개가 끝날 때 마다 정리하는 ㅌ ㅏ래

100일을 다 채우면 깃허브에도 백업해야지 히히


Day 1

# print

# printing 개념

# Write your code below this line 👇
print("Hello World!")
# print("Hello World!)  # print 구문에 '', ""가 없으면 출력되지 않음

# print("she said:"hello" and then left.")
# ""가 있으면 안됨
print('she said:"hello" and then left.')
print("she saide: \"hello\" and then left.")

# enter 작성
print("hello! \nhello! \nhello!")

# 문자열 결합
print("hello" + "mingyu")
print("hello " + "mingyu")
print("hello" + " mingyu")
print("hello" + " " + "mingyu")

# 입력함수
input("what is your name?")
print("hello" + input("what is your name?"))

# variables 

############# start#############
name = input("What is your name?")
print(name)

name = "Jack"
print(name)

name = "mingyu S2"
print(name)

# 변수 설정
# print(len(input("What is your name?")))
name = input("What is your name?")
length = len(name)
print(length)

############# end #############

time_until_midnight = "5"
print("there are " + time_until_Midnight + " hours until midnight")

num_hours = "5"
print("there are " + num_hours + " hours until midnight")

time_until_midnight = "5"
print("there are " +time_until_midnight+ " hours until midnight")

# print name generator

#1. Create a greeting for your program.
print("Welcome to the Band Name Generator")

#2. Ask the user for the city that they grew up in.
city = input("What's the name of the city you grew up in?\n")

#3. Ask the user for the name of a pet.
pet = input("What's your pet's name?\n")

#4. Combine the name of their city and pet and show them their band name.
print("Your band name could be " + city + " " + pet)

#5. Make sure the input cursor shows on a new line:
## \n을 사용하여 print() 문장 뒤에 붙인다.

# Solution: https://replit.com/@appbrewery/band-name-generator-end

# exercise

print문을 사용하여 아래 문장 출력

 

1. Mix 500g of Flour, 10g Yeast and 300ml Water in a bowl.
2. Knead the dough for 10 minutes.
3. Add 3g of Salt.
4. Leave to rise for 2 hours.
5. Bake at 200 degrees C for 30 minutes.

print("1. Mix 500g of Flour, 10g Yeast and 300ml Water in a bowl.")
print("2. Knead the dough for 10 minutes.")
print("3. Add 3g of Salt.")
print("4. Leave to rise for 2 hours.")
print("5. Bake at 200 degrees C for 30 minutes.")

# debugging exercise

print문을 사용하여 아래 문장 출력

 

Day 1 - String Manipulation
String Concatenation is done with the "+" sign.
e.g. print("Hello " + "world")
New lines can be created with a backslash and n.

 

print("Day 1 - String Manipulation")
print("String Concatenation is done with the \"+\" sign.")
print('e.g. print("Hello " + "world")')
print("New lines can be created with a backslash and n.")

# input funtion

모든 이름의 문자 수를 계산하고 출력하는 프로그램 작성

len() 함수를 사용한다.

name = len(input())
print(name)

 

실행하면 아래처럼 뜬다


# 변수

두개의 문자 입력 후 변수 a에 저장된 값을 b로 바꾸는 프로그램을 작성

 

예시

- 입력

a : hellow

b : world

 

- 출력

a : world

b : hello

c = a  #c = 40
a = b  #a = 21
b = c  #b = 40

print("a: " + a)
print("b: " + b)

실행 결과값

'공부 > Python' 카테고리의 다른 글

[Python 100 day challenge ] Day 3 - 1  (0) 2024.03.15
[Python 100 day challenge ] Day 2  (1) 2024.03.15
1장 파이썬 기초 연습문제  (0) 2022.06.11
[GCP] flask로 rest api 구현하기  (0) 2022.05.09
파이썬 함수 정리 1  (0) 2022.04.11
Comments