Found 61 Questions For Programming

How to Find Area of Scalene Triangle using C

Updated on 12-Dec-2021 12:44:54
C Program to Find Area of Scalene Triangle : #include <stdio.h> #include <math.h> int main() { int s1, s2, angle; float area; printf("\nEnter Side1 : "); scanf("%d", &s1); printf("\nEnter Side2 : "); scanf("%d", &s2); printf("\nEnter included angle : "); scanf("%d", &angle); area = (s1 * s2 * sin((M_PI / 180) * angle)) / 2; printf("\nArea of Scalene Triangle : %f", area); return (0); } Output : Ente... Read Mores

How to print hello world using C Language

Updated on 12-Dec-2021 9:39:30
In this example, you will learn to print "Hello, World!" on the screen in C programming. #include <stdio.h> int main() { // printf() displays the string inside quotation printf("Hello, World!"); return 0; } Output : Hello, World! ... Read Mores

How to convert temperature from degree centigrade to Fahrenheit using C

Updated on 12-Dec-2021 9:21:47
C Program to convert temperature from degree centigrade to Fahrenheit #include <stdio.h> int main() { float celsius, fahrenheit; printf("\nEnter temp in Celsius : "); scanf("%f", &celsius); fahrenheit = (1.8 * celsius) + 32; printf("\nTemperature in Fahrenheit : %f ", fahrenheit); return (0); } Output Enter temp in Celsius : 32 Temperature in Fahrenheit : 89.59998 ... Read Mores

How To Send mail from your Gmail account using Python

Updated on 22-Nov-2021 22:09:23
Here, we are going to learn how to send a simple basic mail using Python code. Python, being a powerful language don’t need any external library to import and offers a native library to send emails- “SMTP lib”. “smtplib” creates a Simple Mail Transfer Protocol client session object which is used to send emails to any valid email id on the internet. Different websites use different port numbers. In this article, we are using a Gmail account to send a mail. Port number used here is ... Read Mores

How can we create recursive functions in Python?

Updated on 30-Oct-2021 14:38:44
Recursion is a programming method, in which a function calls itself one or more times in its body. Usually, it is returning the return value of this function call. If a function definition follows recursion, we call this function a recursive function. Also Read : How to get a list of parameter names inside Python function? A recursive function has to terminate to be used in a program. It terminates, if with every recursive call the solution of the problem is becomes smaller and moves towards ... Read Mores

How to get a list of parameter names inside Python function?

Updated on 30-Oct-2021 13:44:28
To extract the number and names of the arguments from a function or function[something] to return ("arg1", "arg2"), we use the inspect module. The given code is written as follows using inspect module to find the parameters inside the functions aMethod and foo. Example import inspect def aMethod(arg1, arg2): pass print(inspect.getargspec(aMethod)) def foo(a,b,c=4, *arglist, **keywords): pass print(inspect.getargspec(foo))  Output ArgSpec(args=['arg1', 'arg2'], varargs=None, keywo... Read Mores

How To Clean Up Unnecessary Code From WordPress Header Without Plugins

Updated on 28-Oct-2021 9:44:44
How To Clean Up Unnecessary Code From WordPress Header Without Plugins How To Remove Weblog Client Link Example: <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.example.com/xmlrpc.php?rsd" /> To remove the EditURI/RSD link from WordPress header, paste the below code into your theme’s function.php. remove_action ('wp_head', 'rsd_link'); How To Remove Windows Live Writer Manifest Link Example: <link rel="wlwmanifest" type="application/wlw... Read Mores

How to redirect HTTP to HTTPS Using htaccess

Updated on 14-Oct-2021 13:50:16
Chrome and Firefox have started showing insecure warnings on sites without SSL certificates. Without SSL, your website will show insecure to the visitors. Therefore, using an SSL-encrypted connection for safety, accessibility or PCI compliance reasons is necessary. It becomes very important to redirect from HTTP to HTTPS. What is SSL? SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted links between a web server and a browser in an online communication. ... Read Mores

How to make a chain of function decorators in Python?

Updated on 30-Jan-2023 19:39:21
Decorators are “wrappers”, which allow us to execute code before and after the function they decorate without modifying the function itself. Example The given code can be wrapped in a chain of decorators as follows. def makebold(fn): def wrapped(): return "" + fn() + "" return wrapped def makeitalic(fn): def wrapped(): return "" + fn() + "" return wrapped @makebold @makeitalic def hello(): return "hello world" print hello() Output C:/Users/codegyan/~.py hel... Read Mores

What are Python function attributes?

Updated on 03-Oct-2021 13:29:18
Everything in Python is an object, and almost everything has attributes and methods. In python, functions too are objects. So they have attributes like other objects. All functions have a built-in attribute __doc__, which returns the doc string defined in the function source code. We can also assign new attributes to them, as well as retrieve the values of those attributes. For handling attributes, Python provides us with “getattr” and “setattr”, a function that takes three arguments.... Read Mores



Advertisements

ads