03.28 월 파이썬1

이재빈·2022년 3월 28일
0

AI스쿨

목록 보기
4/8

오늘 배운것

입문 글
https://docs.google.com/document/d/18CPaWRShjYaA9WQhdObkw7DQMqLUJSwhQwB8YJ5FzJk/edit?usp=sharing

자바와 파이썬의 차이

자바는 script 안에 들어가야함
파이썬은 print(항목)

1.promgraming

console.log(1) 콘솔창에만 나오긴함
<->print(1)

2. 숫자

console.log(1);
console.log(1.2);
console.log(1+1);
console.log(2-1);
console.log(2*2);
console.log(6/2);
console.log(Math.pow(3,2));
console.log(Math.random);

<->

print(1)
print(1.1)
print(1+1)
print(2-1)
print(2*2)
print(6/2)
print(3**2)
print(pow(3,2))
import random
print(random.random())

3.string 글

    console.log('hello')
    console.log("hello")
    console.log(`hello  
    world
     `)       
    console.log('hello'.length)
    console.log('hell world'.replace('hell','hello'))
    

<->
print('hello')
print("hello")
print('''
hello
World
''')
print(len('hello'))
'hell, world!'.replace('hell', 'hello')
print('hell world'.replace('hell','hello'))

JAVA에서는 `(tap위)으로 여러줄 표현, Python에서는 '''(작은따옴표)으로 표현

4. 배열 array <-> list

let member = ['egoing','duru','taeho']
console.log(member[0])
<->
member = ['egoing','duru','taeho']
print(member[0])

갯수 구하기 print(len(member))

랜덤으로 고르기
import random
print(random.choice(member))

배열에서의 합
score = [100,200,300,400]
print(sum(score))

5.variable 변수

let 가격 = 10000;
           let 부가가치세율 = 0.1;
           let 부가가치세 = 가격*부가가치세율;
           console.log(부가가치세);

<->

name = '이고잉'
    print('안녕하세요.'+name+'님,  ....이고잉....안녕히계세요.'+name+'님')

name = '이고잉'
    print(f'안녕하세요.{name}님,  ....이고잉....안녕히계세요.{name}님')

6.input 입력

            let input_id = prompt('id?');
            //만약에 input_id가 egoing과 같다면 아래 코드 실행
                if(input_id==='egoing'){
                    alert(input_id+'님 안녕하세요^^');
                } else{
                    alert(input_id+'님 누구세요?');

<->

갯수 = float(input('몇개?'))   ----------입력값 받아서 출력하는 것
부가세율 = (14-205/30)
부가세 = 갯수*부가세율*0.95
print(부가세)

추가적인 내용

h1>a{text-decoration: none} h1의 직계a만 적용
pow() 제곱, 내장함수

어려웠던 점

차이점을 구별하는것이 어려웠음

알게된 사이트
https://ideone.com/
https://seomal.com/map/1/30 들어볼것

해결방법

학습소감

파이썬이 손이 덜 바쁠것 같아서 좋다

profile
안뇽하세용

0개의 댓글