|
| 1 | +# anagra.py - |
| 2 | + function that takes two strings and returns True if they are anagrams and False otherwise. |
| 3 | + A pair of strings is anagrams if the letters in one word can be arranged to form the second one. |
| 4 | + Test case1: input: listen silent output: True |
| 5 | + |
| 6 | +# fibona.py- |
| 7 | + a recursive function to print nth term of the Fibonacci sequence. |
| 8 | + |
| 9 | +# palind.py- |
| 10 | + a recursive function to check whether a string is a palindrome. |
| 11 | + |
| 12 | +# facto.py- |
| 13 | + a recursive function in Python to find the factorial of a number. |
| 14 | + |
| 15 | +# missi.py- |
| 16 | + a program that uses a for loop to"count mississippily" to |
| 17 | + five. Having counted to five, the program should print to the screen the final message "Ready or not, here I come! |
| 18 | + |
| 19 | +# whiles.py- |
| 20 | + a program that uses a while loop and continuously asks the user to enter a word unless the user enters chupacabra |
| 21 | + as the secret exit word, in which case the message You've successfully left the loop. should be printed to the |
| 22 | + screen, and the loop should terminate. |
| 23 | +# voweleater.py - |
| 24 | + ask the user to enter a word; |
| 25 | + use conditional execution and the continue statement to eat the following vowels |
| 26 | + A, E, I, O, U from the inputted word; |
| 27 | + print the uneaten letters to the screen, each one of them on a separate line. |
| 28 | + |
| 29 | + # twolines.py- |
| 30 | + Using one of the comparison operators in Python, write a simple two-line program that takes the parameter; |
| 31 | + n as input, which is an integer, and prints False if n is less than 100, |
| 32 | + and True if n is greater than or equal to 100. |
| 33 | +# pyarmid.py- |
| 34 | + task is to write a program which reads the number of blocks the builders have, and outputs the height of th |
| 35 | + pyramid that can be built using these blocks; |
| 36 | + he height is measured by the number of fully completed layers - if the builders don't have a sufficient number |
| 37 | + of blocks and cannot complete the next layer, they finish their work immediately. |
| 38 | + The pyramid is stacked according to one simple principle: each lower layer contains one block more than the layer |
| 39 | + above. |
| 40 | + |
| 41 | +# lineinverse.py- |
| 42 | + Reverse the contents of a list without using the reverse() method of a list and without using slicing. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
0 commit comments