Kodomo

Пользователь

Решение заданий практикума №6

inputlen.py

   1 k = input('Enter something: ')
   2 print('Your input is', len(k), 'symbols long')

protlen.py

   1 k = int(input('Input number of first position of start codon: '))
   2 l = int(input('Input number of last position of stop codon: '))
   3 print('Protein is', ((l-k)//3), 'residues long.')

hypotenuse.py

   1 l1 = float(input('Input length of the first leg: '))
   2 l2 = float(input('Input length of the second leg: '))
   3 
   4 print('The length of the hypotenuse is:', round(((l1**2 + l2**2))**(1/2), 3))

alarm.py

   1 t = int(input('Enter the current time: '))
   2 while t >= 12:
   3     t = int(input('Wrong input! Enter the current time again in range from 0 to 11: '))
   4 
   5 a = int(input('Set the alarm time: '))
   6 
   7 l = t + a
   8 
   9 if l < 12:
  10     print('The alarm will ring at', l, "o'clock.")
  11 
  12 else:
  13     while l >= 12:
  14         l -= 12
  15         if l < 12:
  16             print('The alarm will ring at', l, "o'clock.")
  17             break