[Competitive programming] [Python3] Required knowledge, for myself

Post what was in the draft

I will update it if I am addicted to competitive programming

Competition.py


"""
Input value>>> ABC
"""
str = input() # >>> str = "ABC"
strs = list(input()) # >>> strs = ["A","B","C"]

"""
Input value>>> 1
"""
int = int(input()) # >>> int = 1

"""
Input value>>> 1 2
"""
x,y = map(int,input().split()) # >>> x = 1, y = 2

"""
Input value>>> 1 2 3 4 5 ... n
"""
lists = input().split() # >>> lists = ['1','2','3',...,'n']
lists = list(map(int,input().split())) # >>> lists = [1,2,3,4,5,...,n]

"""
Input value>>> FTFTTFTTTFTTTTF 
"""
lists = input().split('T') 
# >>> list = ['F', 'F', '', 'F', '', '', 'F', '', '', '', 'F']

"""
Input value>>> 3
           hoge
           foo
           bar
"""
num = int(input())
lists = [input() for i in range(n)]
# >>> num = 3
# >>> lists = ['hoge','foo','bar']

"""
Input value>>> 1 2 2 3 1
           4 5 3 4 1 2 3 4
           2 3 5 6 0 2
"""
while True:
    try:
        lists = list(map(int,input().split())) 
        #loop
        #1st lap list= [1,2,2,3,1]
        #2nd lap list= [4,5,3,4,1,2,3,4]
        #3rd lap list= [2,3,5,6,0,2]
        #4th lap error(out of range)So go to except.
    except:
        break;

# OR

lists = []
while True:
    try:
        lists.append(list(map(int,input().split())))
    except:
        break;
#lists = [[1, 2, 2, 3, 1], [4, 5, 3, 4, 1, 2, 3, 4], [2, 3, 5, 6, 0, 2]]


"""
Input value>>> 
"""
"""
Input value>>> 
"""
"""
Input value>>> 
"""
"""
Input value>>> 
"""
"""
Input value>>> 
"""
"""
Input value>>> 
"""
"""
Input value>>> 
"""


Recommended Posts

[Competitive programming] [Python3] Required knowledge, for myself
Python3 standard input for competitive programming
python [for myself]
Competitive programming diary python 20201213
Competitive programming diary python 20201220
Competitive programming with python
Competitive programming diary python
Python Competitive Programming Site Summary
Knowledge you need to know when programming competitive programming with Python2
Competitive programming, coding test template: Python3
Competitive programming with python Local environment settings
"Python AI programming" starting from 0 for windows
Detailed Python techniques required for data shaping (1)
AtCoder cheat sheet in python (for myself)
Detailed Python techniques required for data shaping (2)
2016-10-30 else for Python3> for:
Python programming note
I tried python programming for the first time.
Programming in python
Program to search all permutations (for competitive programming)
Summary of frequently used Python arrays (for myself)
Introduction to Programming (Python) TA Tendency for beginners
[Python] Building an environment for competitive programming with Atom (input () can be used!) [Mac]
Knowledge and study methods required for future data analysts
[Python] Measures and displays the time required for processing
Summary of python environment settings for myself [mac] [ubuntu]
Preparing to start "Python machine learning programming" (for macOS)
Kyoto University Python programming practice materials released for free
Tips you should know when programming competitive programming with Python2
Building a Python environment for programming beginners (Mac OS)
python memo (for myself): About the development environment virtualenv
Private memos used for list operations and competitive programming
Programming with your smartphone anywhere! (Recommended for C / Python)
About Python for loops
I tried competitive programming
Python basics ② for statement
3. 3. AI programming with Python
Competitive Pro Template (Python)
[For beginners of competitive pros] Three input methods to remember when starting competitive programming in Python
About Python, for ~ (range)
Refactoring tools for Python
Python programming with Atom
python for android Toolchain
heroku memo (for myself)
Basic knowledge of Python
Python programming in Excel
LEGO Mindstorms 51515 Python Programming
[Python] Dynamic programming ABC015D
OpenCV for Python beginners
Programming with Python Flask
Install Python (for Windows)
[Python] for statement error
Python environment for projects
Freecad memorandum (for myself)
Access google spreadsheet using python on raspberry pi (for myself)
(For myself) Flask_8 (Add / Edit / Delete in database with python)
(For myself) Flask_6 (Open db from python, Mysql basic (phpMyAdmin))