Time for another Pyth practice. I present here 8 problem statements with a Pyth solution each. These solutions are written by a Pyth beginner. He is quite happy about these solutions, since they are a lot shorter than his Python answers. Your task however is to show him better. Create equivalent but shorter programs.
This is a challenge about the the tricks and optimizations that can be used when golfing in Pyth. Pyth golfers may recognize many of the tricks involved, that lead to shorter solutions. However some problems will require some unusual approaches that are rarely used. Some of the tricks I've actually never seen in the wild. But no solution requires any bugs or strange behavior, that was not intentional by the designer(s) of Pyth. All answers must be valid for the most recent Pyth commit (2b1562b) as of this question's posting. You can use the Pyth interpreter for testing. It is up-to-date right now and I don't expect any big changes in Pyth, that will invalidate optimal solutions or make shorter solutions possible. The online interpreter also features the new Character Reference. Since it is pretty new, you can (should) also use the old docs, in case something is incorrect or missing.
Goal: The reference solutions total 81 bytes. Your goal is to beat that by as much as possible. The submission that solves all 8 problems with the smallest total number of bytes wins. Tiebreaker is the submission date.
Of course only submissions are valid, which contain solutions for all 8 problems. You can use the reference implementation, if you can't improve the score of one (or more) particular problem.
Your solutions must print the exact same output as the reference solutions. Except for an optional trailing newline.
Since this is a Pyth practice, only programs written in the language Pyth are allowed.
Answering: Please spoiler your entire answer, except for your total score. It is intended that you do not look at other people's answers before submitting your own. You can create spoilers by putting >! in front of every line, like:
>! Problem 1: V9m?>dNd0S9 (11 bytes)
>! Problem 2: VTN)VGN (7 bytes)
>! ...
I hope I haven't chosen too difficult or too trivial problems. Hoping for a lots of participators and for everyone to gain a few new insights into Pyth. Happy golfing!
Problem 1:
Create the following 9x9 matrix and print it:
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 0, 3, 4, 5, 6, 7, 8, 9]
[0, 0, 0, 4, 5, 6, 7, 8, 9]
[0, 0, 0, 0, 5, 6, 7, 8, 9]
[0, 0, 0, 0, 0, 6, 7, 8, 9]
[0, 0, 0, 0, 0, 0, 7, 8, 9]
[0, 0, 0, 0, 0, 0, 0, 8, 9]
[0, 0, 0, 0, 0, 0, 0, 0, 9]
Reference solution (Link):
V9m?>dNd0S9 (11 bytes)
Problem 2:
Print all digits and all letters on separate lines:
0
...
9
a
...
z
Reference solution (Link):
VTN)VGN (7 bytes)
Problem 3:
Find the lexicographically smallest palindrome, that is lexicographically bigger or equal than an input string containing lowercase letters and is of the same than the input string.
a -> a
abc -> aca
adcb -> adda
Reference solution (Link):
hf&gTzqT_T^Glz (14 bytes)
Problem 4:
Check, if a number is in the range [0, input number). This should also work for floats.
4, 6 -> True
5.5, 6 -> True
6, 6 -> False
6, 6.1 -> True
Reference solution (Link):
&gQ0<QE (7 bytes)
The reference format is to be tested value<newline>end value
. You can choose a different input format however. Important is only, that you accomplish the problem statement and produce the correct results.
Problem 5:
Parse an input string of the format "\d+[a-zA-Z]+". Notice that the number really has to be a number, not a string containing digits.
'123Test' -> [123, 'Test']
Reference solution (Link):
A.ggk\Az,sGH (12 bytes)
Problem 6:
Compute the sum of numbers, that are separated by one or multiple commas. You can assume that there is at least one number in the string.
11,2,,,3,5,,8 -> 29
Reference solution (Link):
svM:z",+"3 (10 bytes)
Problem 7:
Read positive integers from the input until you get the number 0. Print the sum of all numbers.
Reference solution (Link):
WJE=+ZJ)Z (9 bytes)
Problem 8:
Sum up all elements of a square matrix, except the ones of the main diagonal (left upper corner to right bottom corner).
Reference solution (Link):
-ssQs.e@bkQ (11 bytes)