Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- s = input("please enter a s:")
- stringa = A_Ex1(s)
- print("Risultato:",stringa)
- def A_Ex1(s):
- lista = [ord(i) for i in s]
- count = 0
- for x in range(len(lista)):
- if x == 0:
- if lista[x] < lista[x+1]:
- count += 1
- elif x == len(lista)-1:
- if lista[x] > lista[x-1]:
- count += 1
- else:
- if lista[x] > lista[x-1] and lista[x] < lista[x+1]:
- count += 1
- return int(count)
- #Lanciamo main
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement