>>> def printMax(a,b):
  if a>b:
    print(a,'is the max')
  else:
    print(b,'is hte max')


>>> def addOne(a):
  print(a)
  a+=1
  print(a)


>>> a=3
>>> addOne(a)
3
4
>>> def modify(v):
    v[0]=v[0]+1


>>> a=[2]
>>> modify(a)
>>> a
[3]
>>>
>>> def modify(v,item):
  v.append(item)


>>> a=[2]
>>> modify(a,3)
>>> m=modify(a,3)
>>> m
>>> a
[2, 3, 3]
>>>
>>> def modify(d):
  d['age']=32


>>> a={'name':'Dong','age':37,'sex':'Male'}
>>> a
{'sex': 'Male', 'age': 37, 'name': 'Dong'}
>>> modify(a)
>>> a
{'sex': 'Male', 'age': 32, 'name': 'Dong'}

>>> def sys(message,times=1):
  printt((message+'')*times)

>>> say.__defaults__
(1,)

>>> say('Hello Python')
Hello Python

>>> say('Hello Python ',3)
Hello Python Hello Python Hello Python

相关文章:

  • 2021-07-25
  • 2021-07-15
  • 2021-07-09
  • 2021-10-25
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2021-11-29
  • 2021-08-08
相关资源
相似解决方案