Posts

PYTHON NOTES

Image
cmath is a mathematical module that is present in python to convert complex numbers to polar numbers Doubt:  why we use * in cmath as *cmath need to know this (it is raised in polar coordinates problem hacker rank)                       we use * because it clears the brackets and take the input from spaces of lists rpartition() function in Python  split the given string into three parts . rpartition() start looking for separator from right side, till the separator is found and return a tuple which contains part of the string before the separator, the argument of the string, and the part after the separator   In Python 3 we use // for integer division Since set elements must be hashable, and lists are considered mutable,  you cannot add a list to a set . Try Except in Python The try block is  used to check some code for errors  i.e the code inside the try block will execute when there is no error in the program. Whereas the code inside the except block will execute whenever the program

c program notes

Image
  what is an assignment operator? ans.   An  assignment operator  is an operator used to assign a new value to a variable, property, event, or indexer element in the C# programming language. = is assignment operator when we use == means we are comparing both the values and it is equal to operator we should use "abs" before the result of any subtraction or multiplication or addition so that it would be only positive c program to find the grades of students using if statement? #include <stdio.h> int main() {     int marks;     printf("Enter your marks:");     scanf("%d",& marks);     if(100>marks&&marks>=90)     {         printf("your grade is A");     }      if(90>marks&&marks>=80)     {         printf("your grade is B");     }      if(80>marks&&marks>=70)     {         printf("your grade is C");     }      if(70>marks&&marks>=60)     {         printf("your