Lab 5 – 2017

Slides [ EST ] [ ENG ]

All tasks should be submitted via gitlab. Task1 and Task3 are mandatory. Without completing them, Task2 and Task4 won’t be graded.

Homework (3p):

Task 1 (1p)

  1. Create two lists, one for numbers and another for strings
  2. Each list should contain at least 5 elements. Let user enter the values for elements (input)
  3. Create a function, which will calculate and print the sum of elements from numbers list
  4. Create a function, which will print reversed strings from strings list

Task 2 (1p) [optional]

  1. Create file with at least 15 lines of text (manually)
  2. Read 10 characters from the file, print. Repeat this 3 times.
  3. Continue reading file line by line.
  4. Calculate and print total character number in the file.
  5. Add the following text `END TEXT` to the file.

Task3 (0.5p)

  1. Ask user for input.
    1. Input should be not less than 30 characters and not more than 50 characters.
    2. If the condition isn’t met, ask again.
  2. Write the inputted text to a file.

Task4 (0.5p) [optional]

  • Ask user to enter text and split the text by comma.
    • (use at least 5 commas)
  • Calculate the number of letters and digits in each part.
  • Use functions with arguments

One thought on “Lab 5 – 2017

  1. Pingback: Lab 5 – iax058x

Leave a Reply

Your email address will not be published. Required fields are marked *