Advertisement
Guest User

5_6_7_zadachi

a guest
Jan 28th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. # Задача 5 (FOR)
  2. start_index = int(input())
  3. stop_index = int(input())
  4. for index in range(start_index, stop_index + 1):
  5.     ascii_char = chr(index)
  6.     print(ascii_char, end=' ')
  7.  
  8.  
  9. # Задача 6 (Triple FOR) ord('a')
  10. n = int(input())
  11. collection = []
  12. for code in range(ord('a'), n + ord('a')):
  13.     collection.append(chr(code))
  14. for first_char in collection:
  15.     for second_char in collection:
  16.         for third_char in collection:
  17.             print(f'{first_char}{second_char}{third_char}')
  18.  
  19.  
  20. # Задача 7 (FOR)
  21. CAPACITY = 255  # liters
  22. n_lines = int(input())
  23. total_liters = 0
  24. for line in range(1, n_lines + 1):
  25.     add_liters = int(input())
  26.     if total_liters + add_liters > CAPACITY:
  27.         print('Insufficient capacity!')
  28.         continue
  29.     else:
  30.         total_liters += add_liters
  31. print(total_liters)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement