|

Introduction to Python Module Class 11 Notes Computer Science

Introduction to Python Module Class 11 Computer Science   What is module in Python? Modules are simply files with the “. py” extension containing Python code that can be imported inside another Python Program. A module can contain executable statements as well as function definitions. A module allows you to logically organise your python code.   User-Defined Modules…

|

Input a welcome message and display it Python Program

Input a welcome message and display it Python Program   welcome_message=input(“Enter welcome message : “) print(“Hello, “,welcome_message)     Output: Enter welcome message : “Welcome to https://cbsepython.in. This is the best place to learn CBSE Computer Science. Here you can find chapterwise notes for class 11-12, Practice Question Papers, Python Projects for Class 11 and…

|

Input a string and determine whether it is a palindrome or not; convert the case of characters in a string

Input a string and determine whether it is a palindrome or not; convert the case of characters in a string   # Python Program to check whether string is palindrome or not   str=input(“Enter a string:”) w=”” for element in str[::-1]: w = w+element if (str==w): print(str, ‘is a Palindrome string’) else: print(str,’ is NOT…

|

Count and display the number of vowels, consonants, uppercase, lowercase characters in string

Count and display the number of vowels, consonants, uppercase, lowercase characters in string   # Vowels & Consonants count str = input(“Type the string: “) vowel_count=0 consonants_count=0 vowel = set(“aeiouAEIOU”) for alphabet in str: if alphabet in vowel: vowel_count=vowel_count +1 elif alphabet == chr(32): consonants_count=consonants_count else: consonants_count=consonants_count+1 print(“Number of Vowels in “,str,” is :”,vowel_count) print(“Number…

|

Compute the greatest common divisor and least common multiple of two integers

Compute the greatest common divisor and least common multiple of two integers   # GCD PROGRAM num1 = int(input(“Enter 1st number: “)) num2 = int(input(“Enter 2nd number: “)) i = 1 while(i <= num1 and i <= num2): if(num1 % i == 0 and num2 % i == 0): gcd = i i = i…