Skip to content
Snippets Groups Projects
Commit 831d0259 authored by Minseong Kwon's avatar Minseong Kwon
Browse files

Upload New File

parent a811b659
No related branches found
No related tags found
No related merge requests found
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> a=200
>>> def loca_test():
a=200
print(a)
>>> a
200
>>> loca_test()
200
>>> a=100
>>> def local_test():
a=200
print(a)
>>> a
100
>>> local_test()
200
>>> def local_test():
global a
print(a)
a=200
>>> local_test
<function local_test at 0x031628A0>
>>> local_test()
100
>>> a=333
>>> local_test()
333
>>> a
200
>>> ````a
SyntaxError: invalid syntax
>>> a
200
>>> local_test()
200
>>> a=333
>>> a
333
>>> local_test)(
SyntaxError: invalid syntax
>>> local_test()
333
>>> def print(a)
SyntaxError: invalid syntax
>>> def print(a):
p=print
SyntaxError: expected an indented block
>>> def print_some
SyntaxError: invalid syntax
>>> def_print_some:
SyntaxError: invalid syntax
>>> def print_some
SyntaxError: invalid syntax
>>> def print_some:
SyntaxError: invalid syntax
>>> def print_some():
fac
SyntaxError: expected an indented block
>>> fac
Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
fac
NameError: name 'fac' is not defined
>>> fac
Traceback (most recent call last):
File "<pyshell#43>", line 1, in <module>
fac
NameError: name 'fac' is not defined
>>> fac(200)
Traceback (most recent call last):
File "<pyshell#44>", line 1, in <module>
fac(200)
NameError: name 'fac' is not defined
>>> f
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
f
NameError: name 'f' is not defined
>>> def fac(n=0)
SyntaxError: invalid syntax
>>> def fac(n=0):
s=1
if n==0:
return 1
if n>0:
s=s*n
print(s)
return fac(n-1)*n
>>> fac(10)
10
9
8
7
6
5
4
3
2
1
3628800
>>> fac(10)
10
9
8
7
6
5
4
3
2
1
3628800
>>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment