1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
My name is Ann [436]
2 years ago
8

How to 5.4.4 on codehs?

Computers and Technology
1 answer:
iren2701 [21]2 years ago
3 0

The program is an illustration of the square function.

The square function takes a number, and returns the square of the number; i.e. the product of the number twice.

So, the square function in Python, where comments are used to explain each line is as follows:

#This defines the square function

def square(num):

   #This returns the square of the argument

   return num**2

   

#This gets input for the number

num = int(input("Number: "))

#This calculates the square of the number

x = square(num)

#This prints the square

print("Square:",x)

Read more about Python functions at:

brainly.com/question/25120954

You might be interested in
Write a program that removes all spaces from the given input.
sasho [114]

Explanation:

#include<iostream>

#include<string.h>

using namespace std;

char *removestring(char str[80])

{

   int i,j,len;

   len = strlen(str);

   for( i = 0; i < len; i++)

   {

       if (str[i] == ' ')

       {

           for (j = i; j < len; j++)

               str[j] = str[j+1];

           len--;

       }

   }

   return str;

}

int main ()

{  

char  str[80];

   cout << "Enter a string : ";

   cin.getline(str, 80);

   strcpy(removestring(str), str);

   cout << "Resultant string : " << str;

   return 0;

}

In this program the input is obtained as an character array using getline(). Then it is passed to the user-defined function, then each character is analyzed and if space is found, then it is not copied.

C++ does not allow to return character array. So Character pointer is returned and the content is copied to the character array using "strcpy()". This is a built in function to copy pointer to array.

5 0
3 years ago
Which is true of effective passwords?
mylen [45]

Answer:

It is either A. or D.

4 0
3 years ago
Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer va
padilas [110]

Answer:

The code to this question as follows:

Code:

if(x < y) //if block that check value of x less then value of y

{

if(x<z) // inner if block that check value of x less then value of z

{

min = x;  //assign value of x in min variable

}

else // inner else block when condition is false

{

min = z;  //assign value of z in min variable

}

}

else //outer else block

{

if(y<z) //if block to check value of variable y is less then value of z

{

min = y;  //assign value of y in min variable

}

else //else block

{

min = z;  //assign value of z in min variable

}

}

Explanation:

In the given question it is defined, that an integer variable " x, y,z, and min" is declared, in which variable "x,y, and z" value is defined, and the variable is used to assign a big value.

  • To check the biggest value we use the if-else statement in which, and if block check value of x is less than then the value of y if this condition is true so, inside this another if block declares, that will check if the value of x is less then z. if this is true, it will assign the value of x in min variable else it will assign the value of z in min.
  • In the outer else part, another conditional block has used, that checks if the value of y is less than then the value of z if it is true, it assigns the value of y in min else it will assign the value of z in min.
8 0
3 years ago
Which device assists with medical imaging
masya89 [10]
MRI- Magnetic Resonance Imaging

        OR

USI- Ultrasound Imaging
5 0
3 years ago
Read 2 more answers
A problem solving method that involves trying all possible solutions until one works is using ___________.
lakkis [162]
The process of elimination
8 0
4 years ago
Other questions:
  • What is AI and its necessary types?
    6·1 answer
  • Serveral cheetas are growling at each other while hunting for animals.for which need are they competing?
    14·1 answer
  • What must you be careful of when retrieving messages/data from mobile devices in public?
    13·1 answer
  • (HELP ASAP) Jenae is helping her dad create a blog for his garden club. Which tool will she use?
    7·2 answers
  • Out of the following, find those identifiers, which cannot be used for naming Variables, Constants or Functions in a python prog
    11·1 answer
  • Which is an example of an binary number?
    7·2 answers
  • Explain why the computer is powerful working tool???​
    7·1 answer
  • A body performing Shm has a velacity of 12m/s when the displacement is 100mm the displacement
    7·1 answer
  • What is the computer?​
    9·1 answer
  • Protocol 2 - Check for Errors
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!