I had some thoughts, so I modified the contents I'm reposting.
print("Hello World")
#The string is""Or''Must be surrounded by
#One-line comment
"""
Multiple lines
Comment out
"""
Formula | code |
---|---|
addition | + |
subtraction | - |
multiplication | * |
division | / |
Remainder | % |
Multiply | ** |
n=1
print(n)
#output: 1
print(n+2)
#output: 3
① Half-width alphabet(Uppercase and lowercase)
② Half-width numbers
③ _(underscore)
① No numbers can be used as the first letter
② Function names such as print are not allowed
③ After booking(Code such as for)Impossible
④ Japanese is not preferred
Deleted due to circumstances after operation
del variable name
At the time of output int type (number) str type (string) Etc. cannot be mixed and output Separate or convert and output
n =1
print("this is"+n)
#error
print("this is"+str(n))
#output:This is 1
print(1+n)
#output: 2
print(type(variable))
age = 20
print(type(age))
#output: <class 'int'>
code | Contents |
---|---|
str() | String |
int() | Integer value |
float() | Including decimal point |
Recommended Posts