diff --git a/problems/pdf/problem-set-0.pdf b/problems/pdf/problem-set-0.pdf deleted file mode 100644 index 2a77fa7..0000000 Binary files a/problems/pdf/problem-set-0.pdf and /dev/null differ diff --git a/problems/problem-set-0.md b/problems/problem-set-0.md index cde7772..0a68c45 100644 --- a/problems/problem-set-0.md +++ b/problems/problem-set-0.md @@ -1,22 +1,49 @@ # Python Problem Set # 0 -# 1. Given a number between 1 and 100, check if it is prime or not. +# 1. Prime or not -A number is prime if it is divisible by only 1 and itself. 1 is not a prime. -Write a programme which takes a number input, and checks if it is prime or not. +Given a number between 1 and 100, check if it is prime or not. A number is prime if it is divisible by only 1 and itself. +1 is not a prime. ## Input : (1,56,17,"twenty nine") Note the string input in the end. -#2. Using the ideas from first problem, write a programme which gives you first N primes +# 2. N Primes -##Input : (5,10,100) +Using the ideas from first problem, write a programme which gives you first N primes. +## Input : (5,10,100) -Notice the time taken to solve the problem increases as you increase N -What improvements can be made? +Notice the time taken to solve the problem increases as you increase N. What improvements can be made? -#3. Given the coordinates of a triangle, check if it is a right angle triangle or not. Also find it's area. +# 3. Area of a triangle. -## Input : -$$ (x_1, y_1), (x_2,y_2), (x_3,y_3) $$ +Given the coordinates of a triangle, check if it is a right angle triangle or not and find it's area. +## Input : +Six numbers i.e x1, x2, x3, y1, y2, y3 + +# 4. Reversals + + - Given a number, find and print its reverse + + for eg. 1345 -> 5431 + + Note: Try not to use the internet for this, and figure out the 'algorithm' on your own. + + - Given a string, find and print its reverse + + for eg. ahoronov -> vonoroha + + Note: For this, maybe look up how, on the internet. + + - Now that you know the procedure for strings, do you think you can use it to reverse a number? + + Hint: You can convert between 'strings' and 'integers'. + +# 5. Re-ordering + +Given a list of fruits: + + fruits = ['apple', 'banana', 'mango', 'guava', 'orange', 'pineapple', 'strawberry'] + +write a program to re-order them in ascending order of your preference of these fruits.