PyQ ~ Python Beginner ~

print()  #Display the corresponding as a character string
type()  #Returns the type in parentheses
int()  #Returns the applicable integer value
max()  #Returns the maximum value
min()  #Returns the minimum value
abs()  #Returns the absolute value
sum()  #Returns the total value
len()  #Count the number of elements
divmod(a,b)  # a/b[quotient,remainder]
def kansuu(a,b,c,....):  #The function name is arbitrary. a,b,It feels like defining an argument as a variable with c.
    ....  #If processing is performed by the return value, describe the processing content.
return Return value#In some cases it may not be. When there is no return value, such as Print.

#Variables used in a function can only be used within it (scope). ⇄ Global variables
#Rewriting a global variable inside a function does not affect the global variable because it is inside the function.

    global a

#However, if you do the above, you can rewrite the global variable a from within the function. Just deprecated.
from Stored file name import Function name

#After import*It is also possible to bring all the functions with. However, if possible, select only the functions to be used.
#Because I don't know what kind of function is in it, so it may be confusing when using it.

if __name__ == '__main__':
    ....

#It's like a magic trick that doesn't work when importing what is done on the storage file side.
#Strictly__name__Is the executable file name."__main__"An image that looks like an open file.

def main()
    ....
if __name__ == '__main__':
    main()

#By doing this, it is also possible to write a long sentence below if and not to enable it as a function.
tupul = (aaa,bbb,ccc)  #A list that cannot be changed later. The first variable name can be anything.

a = "Element 1"
b = "Element 2"

a , b = "Element 1" , "Element 2"  #Unback substitution part ①
a , b = ( "Element 1" , "Element 2" )  #Unback substitution part 2
a , b = [ "Element 1" , "Element 2" ]  #Unback substitution part ③

#Tuples can also be entered as dictionary keys. On the other hand, the list is not possible.
val = 1  #Initial definition
while val < 10:  #Continue execution as long as this condition is met
    print(val)
    val += 2
print("val->",val)

break  #While when there is a condition that you want to stop iterative processing~~ :You can end it with break.
continue  #When you want to skip the iterative process only that time While~~ :Used with continue.

#While True if you want to continue executing indefinitely unless specified by break:It seems that you should call.

Recommended Posts

PyQ ~ Python Beginner ~
Beginner ABC154 (Python)
Beginner ABC156 (Python)
python beginner memo (9.2-10)
python beginner memo (9.1)
Python beginner notes
[Beginner] Python array
Beginner ABC155 (Python)
[Beginner] Python functions
Beginner ABC157 (Python)
Python beginner memo (2)
Python beginner Zundokokiyoshi
python super beginner tries scraping
Python
Python beginner launches Discord Bot
[Python / PyQ] 4. list, for statement
Web scraping beginner with python
[Python beginner] Update pip itself
Atcoder Beginner Contest 152 Kiroku (python)
Let's play with Excel with Python [Beginner]
[Python beginner] Divide one list (5 lines).
[Beginner] Extract character strings with Python
Python beginner tried 100 language processing knock 2015 (05 ~ 09)
AtCoder Beginner Contest 174 C Problem (Python)
Python beginner tried 100 language processing knock 2015 (00 ~ 04)
kafka python
Python basics ⑤
A note where a Python beginner got stuck
python + lottery 6
Python Summary
Built-in python
Python comprehension
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python tips
Python memo
Beginner Kmeans
Python comprehension
Python Singleton
Python basics ④
Python Memorandum 2
[Beginner] Python web scraping using Google Colaboratory
Python increment
atCoder 173 Python
[Python] function
Python installation
python tips
Installing Python 3.4.3.
Try python
Python memo
Python iterative
Python algorithm
Python2 + word2vec
[Python beginner] Join two lists alternately (5 lines).
Python beginner Atcoder memo @ KEYENCE 2020, ABC problem
[Python] Variables
Python functions
Python sys.intern ()