===========================================

문제1. “가위”, “바위”, “보” 출력해 보기

 

 

<출력 예시>

 

가위

바위

 

 

<소스>

 

print("가위")

print("바위")

print("보")

===========================================

 

 

 

===========================================

문제2. 입력 받은 값을 출력해보기

 

 

<출력 예시>

 

“가위” 입력시

입력은 가위 입니다.

 

“3” 입력시

입력은 3 입니다.

 

 

<소스>

 

a = input("입력하세요 = ")

 

print("입력은 " + a + " 입니다")

===========================================

 

 

 

===========================================

문제3. 랜덤한 수 출력

 

 

<출력 예시>

 

1에서 3까지 랜덤한 수를 출력하시오.

 

1

 

3

 

2

 

...

 

 

<소스>

 

import random

 

a = random.randrange(1, 4)

 

print(a)

===========================================

 

 

 

===========================================

# 틀린 부분과 필요 없는 부분이 있다. 

 

가위바위보 게임

 

#컴퓨터 입력

 

import random

 

com = " "

 

com = random.randrange(1, 4)

 

com = str(com)

 

print("컴퓨터는 " + com + " 를 선택하였습니다.")

 

if com == "1" :

    print("컴퓨터는 가위 입니다.")

elif com == "2" :

    print("컴퓨터는 바위 입니다.")

else:

    print("컴퓨터는 보 입니다.")



#당신 입력

 

you = " "

 

you = str(you)

 

you = input("가위 바위 보 를 입력하세요.")

 

print("당신은 " + you + "를 입력하셨네요")



#처리

if you == "가위" and com == "1" :

    print("비겼습니다.")

 

elif you == "가위" and com == "2" :

    print("당신은 졌습니다.")

 

elif you == "가위" and com == "3" :

    print("당신은 이겼습니다.")



if you == "바위" and com == "1" :

    print("당신은 이겼습니다.")

 

elif you == "바위" and com == "2" :

    print("비겼습니다.")

 

elif you == "바위" and com == "3" :

    print("당신은 졌습니다.")



if you == "보" and com == "1" :

    print("당신은 졌습니다.")

 

elif you == "보" and com == "2" :

    print("당신은 졌습니다.")

 

elif you == "보" and com == "3" :

    print("비겼습니다.")

===========================================



 

 

 

 

 



'주제선택_파이썬' 카테고리의 다른 글

주제선택 ppt  (0) 2025.03.16

1차시 - OT

https://docs.google.com/presentation/d/1AaIkZP4Eew2NYmg9Z2V6mhL72mukmze0iyXM9tifIms/edit?usp=sharing

 

파이썬_1

파이썬 기본 문법 배우기, 그리고 텍스트 게임 만들어 보기.

docs.google.com

 

 

 

 

 

2차시

https://docs.google.com/presentation/d/1f6m3T1laoIL_BbvX1m1eEmXNu512x-U91gaRfO4d-J4/edit?usp=sharing

 

파이썬_2

주제선택 - 파이썬(2) 1. 파이썬 설치 2. print 문법 3. 변수

docs.google.com

 

 

 

3차시

https://docs.google.com/presentation/d/1_c-WqCGuUeN9s0XoTiHXta3BuLMofs9pXBpzVyC6XsU/edit?usp=sharing

 

파이썬_3

주제선택 - 파이썬(3) 1. 변수 연산 2. 데이터 타입 3. 입력

docs.google.com

 

 

 

4차시

https://docs.google.com/presentation/d/1hELAjXbuVnAMVHfV_NFLxPI0uwV9l_RFBd3h67jU6sU/edit?usp=sharing

 

파이썬_4

주제선택 - 파이썬(4) 1. 조건문

docs.google.com

 

 

 

5차시

https://docs.google.com/presentation/d/1RfnNFUWxVKV8fFDW_htZnd5US_NnlylBj3V1sElRG2U/edit?usp=sharing

 

파이썬_5

주제선택 - 파이썬(5) 1. 복습(출력문, 반복문) 2. random

docs.google.com

 

 

 

6차시

https://docs.google.com/presentation/d/1imM2AnigfcL1vQ6zZdr71i8dBAXNS4ZDDgBeD4XEH74/edit?usp=sharing

 

파이썬_6_학생용

반성문을 영어로 하면?

docs.google.com

 

'주제선택_파이썬' 카테고리의 다른 글

요약  (3) 2025.05.04

+ Recent posts