Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 1.44 KB

README.md

File metadata and controls

31 lines (25 loc) · 1.44 KB

Exercise Instruction

Exercise 1: asterisk pattern

Please write a python script to print the following pattern, where the number of rows is given by the user.

Expected result

please input a number: 9
*
**
***
****
*****
****
***
**
*

Exercise 2: Guess the number

Please write a python script to make a number guessing game with the following features:

  • In this game, the program generates random number but this number is not visible to the player.
  • Player tries to guess the number. If the player enters the same number that is generated by system then program displays the winning message and game ends there.
  • If the player enters wrong number then that number is evaluated. If the number is greater than right answer than system gives a hint that entered number is ‘high’ otherwise if number is smaller than right answer than it says ‘lower’.

Exercise 3: factorial calculator

Please write a python script to calculate the factorial of a given number. If the number is negative, please print an error message. If the number is omitted, print the factorial of 0.

Exercise 4: is_palindrome

Please write a python script to check if a given string is a palindrome. A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam, racecar. The program should ignore spaces and cases. Assume that the input is a string and there is no punctuation other than spaces.