Category Archives: Programs

Check if given string contains Even 1’s and Odd 0’s

In this problem a string is given, our task is to check the string contains even number of 1’s and odd number 0’s or not. Examples: Input : “101010100” Output : Accept Input : “111001010101” Output : Not Accept Approach used in function: we firstly declare set s which contain ‘0’ and ‘1’ and create set of the… Read More »

Find Words containing ‘a’ in given String

Given a statement(string), the task is to check if that string contains any word which contains ‘a’ in it then print that word otherwise print no any word containing ‘a’ in the inputed string. Examples : Input: “W3Colleges provides excellent tutorials” Output: tutorials Input: “Python is fun” Output: no any word containing ‘a’ in the inputed string Input:… Read More »

Check if given string is Binary string

In this problem a string is given, our task is to check the string is binary string or not. Examples:  Input : ‘01010101010’ Output : Accepted Input : ‘w3colleges101’ Output : Not Accepted # 1st method : This approach used in function: we firstly create set of the characters present in the given string using set() function and… Read More »

Find the Nth Triacontakaihenagonal Number

Given a number N, the task is to find Nth triacontakaihenagonal number. A triacontakaihenagonal number is class of figurate number. It has 31 – sided polygon called triacontakaihenagon. The N-th triacontakaihenagonal number count’s the 31 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The first few triacontakaihenagonol numbers… Read More »

Check if a Number is Pentacontagon

Given an integer N, the task is to check if it is a pentacontagon number or not. Pentacontagon number is class of figurate number. It has 50 – sided polygon called pentacontagon. The N-th pentacontagon number count’s the 50 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »