Invent Your Own Computer Games with Python2 파이썬 - 농담게임 Invent Your Own Computer Games with Python, 4th Edition 이라는 책을 바탕으로 만들었습니다. 4장 농담게임 4장은 농담게임이다. 넌센스 퀴즈가 출력되면 입력을 받고 답을 출력하는 간단한 프로그램이다. # jokes 게임의 출력 입력의 반복 print('What do you get when you cross a snowman with a vampire?') input() print('Frostbite!') print() print('What do dentists call an astronaut\'s cavity?') input() print('A black hole!') print() print('Knock knock.') input() print("Who's t.. 2022. 5. 6. 파이썬 - 숫자 맞추기 게임 Invent Your Own Computer Games with Python, 4th Edition 이라는 책을 바탕으로 만들었습니다. 1장은 사칙연산과 변수에 숫자를 넣어 계산하는 기본적인 내용에 대해 다루었다. 2장은 문자열의 덧셈과 출력, 입력에 대해 간단하게 이루어져있다. 3장 숫자맞추기 게임 3장은 숫자맞추기 게임을 구현하는 문제이다. 규칙을 아래와 같다. 컴퓨터는 1~20사이의 숫자 하나를 비밀로 가지고 있을 것이다. 숫자를 예측할 때마다 컴퓨터는 그 숫자가 큰지 작은지 알려줄 것이다. 6번의 기회 안에 맞춰야 성공이다. # 랜덤으로 숫자를 만들어주기 위해서 random을 불러오고 1~20사이의 숫자를 변수에 저장한다. import random guessNum = random.randint(1.. 2022. 5. 4. 이전 1 다음