embedded system,Arduino,Raspberry pi,ARM7,MM32,STM32,PIC and Python,Django,Datascience and web development
Thursday, August 29, 2019
del keyword usage in python
"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 11;
print(f)
del f
print(f)
output:
del f
^
IndentationError: unexpected indent
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 11;
print(f)
del f
print(f)
output:
del f
^
IndentationError: unexpected indent
global key word usage in python
"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 101;
print(f)
# Global vs.local variables in functions
def someFunction():
global f
print(f)
f = "changing global variable"
someFunction()
print(f)
output:
101
101
changing global variable
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 101;
print(f)
# Global vs.local variables in functions
def someFunction():
global f
print(f)
f = "changing global variable"
someFunction()
print(f)
output:
101
101
changing global variable
declaration and re-declaration of the variable
"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
# Declare a variable and initialize it
f = 0
print(f)
# re-declaring the variable works
f = 'guru99'
print(f)
output:
0
guru99
example 3:
"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
# Declare a variable and initialize it
f = 101
print(f)
# Global vs. local variables in functions
def someFunction():
# global f
f = 'I am learning Python'
print(f)
someFunction()
print(f)
output:
101
I am learning Python
101
defination in python
"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
def main():
print("hello world\n");
if __name__ =="__main__":
main()
print("testing")
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
def main():
print("hello world\n");
if __name__ =="__main__":
main()
print("testing")
Wednesday, August 28, 2019
NUMBER SERIES BASIC TESTING
/**************************************************
** written by :ANIL DURGAM
** NUMBER SERIES TESTING VER 1.0
**DATE:29-08-2019
**************************************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int first_num,sec_num,third_num,fourth_num,next_number;
int first_diff,second_diff,third_diff,fourth_diff;
printf("please enter the FOUR number after every number hit ENTER\n");
scanf("%d%d%d%d",&first_num,&sec_num,&third_num,&fourth_num);
printf("first number=%d,\nsecond number=%d,\nthird number=%d,\nfourth number=%d\n",first_num,sec_num,third_num,fourth_num);
first_diff=sec_num-first_num;
second_diff=third_num-sec_num;
third_diff=fourth_num-third_num;
if(first_diff==second_diff)
{
if(third_diff==second_diff)
{
next_number=first_diff+fourth_num;
printf("next number is ==%d\n",next_number);
}
else
{
printf("third and fourth number is not matching\n");
}
}
else{
printf("number not matching\n");
}
return 0;
}
** written by :ANIL DURGAM
** NUMBER SERIES TESTING VER 1.0
**DATE:29-08-2019
**************************************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int first_num,sec_num,third_num,fourth_num,next_number;
int first_diff,second_diff,third_diff,fourth_diff;
printf("please enter the FOUR number after every number hit ENTER\n");
scanf("%d%d%d%d",&first_num,&sec_num,&third_num,&fourth_num);
printf("first number=%d,\nsecond number=%d,\nthird number=%d,\nfourth number=%d\n",first_num,sec_num,third_num,fourth_num);
first_diff=sec_num-first_num;
second_diff=third_num-sec_num;
third_diff=fourth_num-third_num;
if(first_diff==second_diff)
{
if(third_diff==second_diff)
{
next_number=first_diff+fourth_num;
printf("next number is ==%d\n",next_number);
}
else
{
printf("third and fourth number is not matching\n");
}
}
else{
printf("number not matching\n");
}
return 0;
}
OUTPUT:
please enter the FOUR number after every number hit ENTER
12
24
36
48
first number=12,
second number=24,
third number=36,
fourth number=48
next number is ==60
format type in c language
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=789,b=1234;
printf("a=%3d, b=%4d", a, b);
return 0;
}
output:
a=789,b=1234
input is
a=9,b=4;
a= 9, b= 4
#include <stdlib.h>
int main()
{
int a=789,b=1234;
printf("a=%3d, b=%4d", a, b);
return 0;
}
output:
a=789,b=1234
input is
a=9,b=4;
a= 9, b= 4
"\r" carriage return in c programming language
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello \rworld!\n");
return 0;
}
#include <stdlib.h>
int main()
{
printf("Hello \rworld!\n");
return 0;
}
output :
world
because of \r in the printf statement....so after \r the statements will be executed
Subscribe to:
Posts (Atom)
-
How to do the programming python in windows command prompt Step 1: please go through below link website f...
-
Serial.print() Description Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers a...