Python Essentials Classroom Series – 03/July/2021

Solution to Exercises

  • Exercise:
    • Write to Jarvis
      • to find if the number is prime or not
      Hello Jarvis
      take input from user and store in number
      index = 2
      until index < number
      start
          if number%index == 0
              print ('not prime')
              exit
          index = index + 1
      end
      print('prime')
      
      • to find the factorial of a number (5! = 5 * 4* 3 * 2 * 1 )
      Hello Jarvis
      result = 1
      take input from user and store in number
      index = 1
      until index <= number
      start
          result = result*index
          index = index + 1
      end
      print(result)
      

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin