본문 바로가기

Python100

파이썬 가위바위보 인공지능 프로그램 만들기 #가위/바위/보 를 선택하세요 #나 : 가위 #컴 : 보 # 결과 : 비김 from random import random from _ast import If me = input("가위/바위/보를 선택하세요") arr = ["가위","바위","보"] com = int(random()*4) print("니:{}".format(me)) print("컴퓨터{}".format(arr[com])) if (me=="가위" and arr[com]=="보") or (me=="바위" and arr[com]=="가위") or (me=="보" and arr[com]=="바위"): print("결과 : 이김") elif (me=="보" and arr[com]=="가위") or (me=="가위" and arr[com]=="바위".. 2023. 6. 24.
파이썬 OOP(Object Oriented Programming)객체지향 test test1 from future.backports.xmlrpc.client import boolean class Animal: # print("생성자") def __init__(self): self.flag_sound = True #메소드 def bbeonguri(self): self.flag_sound = False # 메모리에서 사라질떄 호출됨 def __dal__(self): # print("소멸자") pass # toSting과 같음 def __str__(self): return "소리능력" + str(self.flag_sound) # if __name__ == '__main__': # a = Animal() # print(a.flag_sound) # a.bbeonguri() # print(a.f.. 2023. 6. 23.
안드로이드 스튜디오 돌핀버전 다운로드 하는 방법 https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html#2021 Android Studio Releases List | IntelliJ Platform Plugin SDK plugins.jetbrains.com https://developer.android.com/studio/archive 이건 바로 다운로드됨 https://redirector.gvt1.com/edgedl/android/studio/install/2021.3.1.17/android-studio-2021.3.1.17-windows.exe 2023. 6. 23.
파이썬 기초Test(테스트) test10 # 첫 수를 입력하세요 7 # 끝 수를 입력하세요 9 #7은 9보다 2만큼 작다 #9는 7보다 2만큼 크다 # 같은 숫자입니다 a= input(" 첫 수를 입력하세요") b= input(" 끝 수를 입력하세요") c=int(a)-int(b) if c0: print("{}은{}보다 {}만큼 크다".format(a,b,c)) else : print("같다") test11 # 첫 수를 입력하세요 7 # 끝 수를 입력하세요 9 #7은 9보다 2만큼 작다 #9는 7보다 2만큼 크다 # 같은 숫자입니다 a= input(" 첫 수를 입력하세요") b= input(" 끝 수를 입력하세요") c=int(a)-int(b) if c0: print("{}은{}보다 {}만큼 크다".format(a,b,c)) els.. 2023. 6. 23.
파이썬 함수(function) def예제 1.함수로 연산하기 def add(a,b): return a+b def minnus(a,b): return a-b def multiply(a,b): return a*b def divide(a,b): return a/b sum = add(4,2) min = minnus(4,2) mul = multiply(4,2) div = int(divide(4,2)) print("sum",sum) print("min",min) print("mul",mul) print("div",div) 2.함수로 구구단 출력 def showDan(dan): for i in range(1,9+1): print("{}*{}={}".format(dan,i,dan*i)) showDan(7) 3.함수로 홀짝 출력 from random impor.. 2023. 6. 23.
TypeError: 'module' object is not callable(오류) 원인 위 의미는 말그대로 모듈객체는 호출이 불가능한데 호출하려 해서 발생하는 에러이다. 해결 2023. 6. 23.