Posts

Most Useful String Functions in Python

Image
Most Useful String Functions in Python 1. len(str) :  Returns Length of String str=input("Enter String : ") print("LENGTH OF ",str," : ",len(str)) -------------------------------------------- 2. str.upper() : Converts all characters in the string to uppercase. str=input("Enter String in Lower Case Letter : ") print(str.upper())  -------------------------------------------- 3. str.lower() : Converts all characters in the string to lowercase. str=input("Enter String in UPPER Case Letter : ") print(str.lower())   -------------------------------------------- 4. str.capitalize() : Capitalizes the first letter of the string and converts all other characters to lowercase. str=input("Enter String in lower Case Letter : ") print(str.capitalize())    -------------------------------------------- 5. str.title() : Capitalizes the first letter of each word in the string. str=input("Enter String in lowe...

Conditional Operator in C (Ternary Operator in C)

Image
Conditional Operator in C   (Ternary Operator in C) Introduction Conditional Operator can be used as alternative for if else Conditional statement . Lets Understand how if else statement works.             if( Condition )               {                                Block to be executed                              if Condition becomes True ;               }               else               {                               Block to be executed                 ...

Switch Case Statement in C

Image
SWITCH CASE STATEMENT IN C  (MENU DRIVEN PROGRAMMING IN C ) Switch Case In General . . . . Menu Driven Programs in C Language can be written, in most easiest way using "Switch Case" Statement. Switch case statements can be used as alternative for "if... else ladder", where you can choose to execute single block of code among multiple blocks. Then question remains..... what is difference between if... else ladder and Switch case..? Lets understand this with simple example. You have a Electric Switch Board with around 20 switches on it. If someone ask you to switch on fan, what would you have done in this situation when you don't know which switch belong to fan. Now suppose that, 18th Switch is fan's switch. you might have start checking from first switch and after checking first 17 switches you would have come to know that 18th switch belongs to fan. Now, what if same condition occurs once again ..?. In this case you would have switched on 18th Switch directl...

If Statements in C

Image
  Decision Making/Control Statements In C Introduction Sometimes, while writing code, programmer has to take decision like, which statements or block of code to be executed and which statements or block of code to be skipped during execution. Such kind of decisions programmer can take using Decision Making Statements in C. for example if user age is above or equal to 18, user will be eligible for voting. if account balance is below minimum, user cannot withdraw money. user having multiple options and one of option has to be executed. and so on.... So, these kind of conditions decides flow of program. Decision Making Statements in C can be divided into following types 1. if statement 2. switch case statement 3. Conditional/Ternary Operator 4. goto Statement. In this Article we will see if Statements in c if Statement in C if statements are divided into following types 1. Simple if 2. if else statement 3. Nested if else statement 4. if else ladder 1. Simple if Statement : Simple...