Skip to main content

How to display Developer Tab in Excel

Follow below steps to enable or bring Developer tab on front.

Step 1) Click on File Menu (Available at top left)

Step 2) Click on Sub menu Options

System will display Excel options Pop Window

Step 3) Click on Customize Ribbon Options available at left side of Menu.

System will display Customize Ribbon section with two columns like choose commands from and customize the ribbon

Step 4) Click on Check box (enable it) for Developer Tab which is available in Customize the Ribbon Section.

Step 5) Click on Ok button

Observe that Developer tab is now displayed after “View”
User can perform various operations like Record Macros, Run Macros etc.

Python code to print the key values in dictionary-like maximum, minimum, specific record

Here is complete running code for python which gives output for printing maximum, minimum from key elements, and associated value. Print complete dictionary. Print specific number record.

thisdict = {
  "1": "C language",
  "2": "Java Language",
  "4": "Python Language",
  "3": "C++",
}
maxNumber= max(thisdict,key=thisdict.get)
print(maxNumber)
print('\n\n')
minNumber = min(thisdict,key=thisdict.get)
print(minNumber)
print("\n\n")

# Print key-value pairs in dictionary whose key is maxNumber
for key, value in thisdict.items():
    if key == maxNumber:
        print(key, '::', value)
print('\n\n')

#print complete dictionary
print(thisdict)
print('\n\n')
#print 2nd record from dictionary

n=2
for index, (key, value) in enumerate(thisdict.items()):
    if index == n:
        print(key, '::', value)
        break

Output

4



1



4 :: Python Language



{'1': 'C language', '2': 'Java Language', '4': 'Python Language', '3': 'C++'}



4 :: Python Language

To python code online refer free online compiler.

Code to write Fibonacci series for number of elements as per user input.

Fibonacci series means a series of numbers in which each number is the sum of the two preceding numbers. Example is 1, 1, 2, 3, 5, 8

Below is C program code to print Fibonacci series as per user input.

for e.g if user input 20 then program will print 20 elements in Fibonacci series.

//Program Name: Print fibonacci series using for loop upto n term
// for e.g 1, 1, 2, 3, 5, 8

#include <stdio.h>

void main()
{
    int s1=0,s2=1; //initializing first two numbers 
    int nextNum=0,numCnt=0,i;

    printf("\n\n\tPlease enter how many numbers need to print in Fibonacci series.\t");
    scanf("%d",&numCnt);
    //here assuming user will enter value more than 1 
    //printing first two numbers
    printf("\n\tBelow are %d numbers in Fibonacci Series  ",numCnt);
    printf("\n\n\t%d %d",s1,s2);
     for(i=2;i<numCnt;i++)
    {    
        nextNum=s1+s2;
        printf(" %d",nextNum); 
        s1=s2;    
        s2=nextNum; 
       
    }  
}

Output

        Please enter how many numbers need to print in Fibonacci series.       20

        Below are 20 numbers in Fibonacci Series  

        0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181

If you want to print Fibonacci series up to particular number then refer this link

How to write simple C Program for Fibonacci series using for loop

Fibonacci series means a series of numbers in which each number is the sum of the two preceding numbers. Example is 1, 1, 2, 3, 5, 8

Below is C program code to print Fibonacci series as per user input or up to n number.

for e.g if user input 200 then program will print Fibonacci series till 200 meaning sum which is less than or equal to 200.

//Program Name: Print fibonacci series using for loop upto n term
// for e.g 1, 1, 2, 3, 5, 8

#include <stdio.h>

void main()
{
    int s1=0,s2=1; //initializing first two numbers 
    int nextNum=0,SumUpto=0;

    printf("\n\n\tPlease enter number up to which print Fibonacci series is required \t");
    scanf("%d",&SumUpto);
    //here assuming user will enter value more than 1 
    //printing first two numbers
    printf("\n\tfibbonacci Series up to %d is ",SumUpto);
    printf("\n\n\t%d  %d",s1,s2);
     for(nextNum=2;nextNum<=SumUpto;)
    {    
 
        s1=s2;    
        s2=nextNum; 
        printf(" %d",nextNum); 
        nextNum=s1+s2;
    }  
}

Output


        Please enter number up to which print Fibonacci series is required      200

        Fibonacci Series up to 200 is 

        0  1 2 3 5 8 13 21 34 55 89 144

Another method to find the Fibonacci numbers is by using the golden ratio (1.618034).

Here is a method to find the Fibonacci series using the golden ratio method.

Just by multiplying the previous Fibonacci Number by the golden ratio(1.618034), we get the approximated Fibonacci number. For example, 2 × 1.618034… = 3.236068. This gives the next Fibonacci number 2 after 3.

C code for Fibonacci series using the golden ratio.

// Fibbonaci series using golden ratio.
#include <stdio.h>
#include <math.h>
int main() {
    // Write C code here
    float result=1.0;
    //result=1.0;
    printf("\n0\n1\n1");
    for(int i=1;i<15;i++)
    {
        result = lround( result * (1.618034));
        printf("\n%d",lround(result));
    }
}

Output

0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987

Python program to reverse string using for loop

Below is running program in python which accept input string from user. using for loop it is reversing the string.

# Sample python program to reverse string using for loop

inputString = input('\n\nEnter string to perform reverse operation\t')


reverseString='' #Declaring empty reverse string variable.

for ch in inputString:
    reverseString = ch + reverseString

print('Reverse of  ' ,inputString, '  is   =>',reverseString)

Output


Enter string to perform reverse operation	reverse
Reverse of   reverse   is   => esrever
>>> 

C Program for smallest, largest of three number using ternary operator

Below running code will accept 3 Numbers from user.

Based on results given in expression in ternary operator program will return smallest number

// Program Name: C Program to find smallest number using Ternary operator
#include <stdio.h>

void main()
{
    int num1,num2,num3;
    int counter;
    printf("\n\tEnter first Integer Number\t");
    scanf("%d",&num1);
    printf("\n\tEnter Second Integer Number\t");
    scanf("%d",&num2);
    printf("\n\tEnter Third Integer Number\t");
    scanf("%d",&num3);
    
    
    // Ternary operator
    counter = (num1 < num2) ? (num1 < num3 ? num1:num3) : (num2 < num3 ? num2:num3);
    
    printf("\n\t Minimum of 3 Number is %d", counter);
}

Output


        Enter first Integer Number      11

        Enter Second Integer Number     90

        Enter Third Integer Number      32

         Minimum of 3 Number is 11

To find another method Click here . Program to find smallest number without comparison

Program to find largest or greatest of 3 number using ternary operator

Accept 3 numbers from user using scanf. User ternary operator to compare them and print result using printf. Here is complete code.

// Program Name: C Program to find largest number using Ternary operator
#include <stdio.h>

void main()
{
    int num1,num2,num3;
    int counter;
    printf("\n\tEnter first Integer Number\t");
    scanf("%d",&num1);
    printf("\n\tEnter Second Integer Number\t");
    scanf("%d",&num2);
    printf("\n\tEnter Third Integer Number\t");
    scanf("%d",&num3);
    
    
    // Ternary operator
    counter = (num1 > num2) ? (num1 > num3 ? num1:num3) : (num2 > num3 ? num2:num3);
    
    printf("\n\t Largest of 3 Number is %d", counter);
}

Output

Enter first Integer Number	4
Enter Second Integer Number	5
Enter Third Integer Number	6
Largest of 3 Number is 6

C Program for Smallest of three numbers without comparing

There are many ways to find smallest. Below program will accept 3 integer numbers from user

We are using while loop here and one increment variable.

Every time program is subtracting value by 1 and incrementing counter variable by 1. once condition is false program will return smallest number. This is simple basic mathematical operation. Below is complete running code.

// Program Name: C Program to find smallest number without comparison
#include <stdio.h>

void main()
{
    int num1,num2,num3;
    int counter=0;
    printf("\n\tEnter first Integer Number\t");
    scanf("%d",&num1);
    printf("\n\tEnter Second Integer Number\t");
    scanf("%d",&num2);
    printf("\n\tEnter Third Integer Number\t");
    scanf("%d",&num3);
    
    
    // Here we are using while loop when result is false we will get smallest number 
    while(num1 && num2 && num3)
    {
        num1--;
        num2--;
        num3--;
        counter++;
    }
    printf("\n\t Minimum of 3 Number is %d", counter);
}

Output

Enter first Integer Number      4

        Enter Second Integer Number     3

        Enter Third Integer Number      0

         Minimum of 3 Number is 0

Use of interactive prompt or mode in python

On starting python interactive mode we get below output

Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

In interactive mode it is not necessary to use “print” command explicitly. see below

>>> print("python interactive")
python interactive
>>> "python interactive"
'python interactive'
>>>

Interactive prompt runs code and echo immediately. But code which we write on interactive prompt does not get saved. To perform experiment with functions in python we can use this prompt. interactive prompt runs one statement at one time.

Run python program online here

How python code get executed – architecture

Python is interpreted language. When user execute any python file then internally it compiles the code in bytecode format. Byte code is lower level representation of source code. These compiled (bytecode) files are available on machine in .pyc format.

So when we run the program again without any change then python again load that .pyc files by skipping compilation step.

If python don’t have write access then those pyc files get created in memory and get discarded on exiting program.

Once program is successfully compiled to byte code then it gives those code to Python Virtual Machine. PVM (Python virtual machine) is just run time engine from Python. Which is completely hidden from end user or programmer. PVM converts this bytecode in machine executable.

Latest version of python can be downloaded from here https://www.python.org/downloads/