python exercises 01

1. Programming to find the maximum and minimum values ​​of a list whose elements are all numbers

a.soft

If you are looking for the maximum value from a list, you can use max()

If you are looking for the maximum value from an array, you can use the numpy.max() function

2. Count the number of characters in the string

  hello world

a=input(“xxxxx”)

xcount = 1

for i in a

   if i = x:

    xcount +=1

print(“x=%d”%xcount)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324985473&siteId=291194637