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
oee [108]
4 years ago
10

Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by a space a

nd your first name.
Computers and Technology
1 answer:
vekshin14 years ago
5 0

Answer:

def name_string( name ):

     user_name = name

     split_name = user_name.split(" ")

     list( split_name )

    print ( split_name[ 1 ], ", ", split_name[ 0 ] )

# the test should print out " Turing, Alan"

name_string ( " Alan Turing " )  

Explanation:

The python function above should print out the reverse of a name and surname and separated by a comma.

You might be interested in
This chapter uses the class rectangleType to illustate how to overload the operators +, *, ==, !=, >>, and <<. In th
sattari [20]

Answer:

Check the attached image for code screenshot and output.

Explanation:

#######################################

      Rectangle.cpp

#######################################

#include "Rectangle.h"

Rectangle::Rectangle() {

       length = 0;

       width = 0;

}

Rectangle::Rectangle(double newLength, double newWidth) {

       length = newLength;

       width = newWidth;

}

void Rectangle::setLength(double l) {

       length = l;

}

void Rectangle::setWidth(double w) {

       width = w;

}

double Rectangle::getLength() {

       return length;

}

double Rectangle::getWidth() {

       return width;

}

double Rectangle::computeArea() {

       return length * width;

}

double Rectangle::computePerimeter() {

       return 2 * (length + width);

}

Rectangle Rectangle::operator++ () {

       length++;

       width++;

       return *this;

}

Rectangle Rectangle::operator++ (int) {

       Rectangle r(length, width);

       ++length;

       ++width;

       return r;

}

Rectangle Rectangle::operator-- () {

       if(length > 0) {

               length--;

       }

       if(width > 0) {

               width--;

       }

       return *this;

}

Rectangle Rectangle::operator-- (int) {

       Rectangle r(length, width);

       if(length > 0) {

               length--;

       }

       if(width > 0) {

               width--;

       }

       return r;

}

Rectangle Rectangle::operator- (Rectangle other) {

       

       if(length > other.length && width > other.width) {

               length--;

               width--;

       } else {

               cout << "invalid operation. Subtrated Rectangle is bigger" << endl;

       }

       return *this;

}

bool Rectangle::operator==(Rectangle other) {

       return (length == other.length) && (width == other.width);

}

bool Rectangle::operator!=(Rectangle other) {

       return (length != other.length) || (width != other.width);

}

void Rectangle::printDetails() {

       cout << "Rectangle Report" << endl;

       cout << "Dimensions: " << length << " X " << width << endl;

       cout << "Area: " << computeArea() << endl;

       cout << "Perimeter: " << computePerimeter() << endl;

       cout << "********************" << endl;

}

#######################################

        Rectangle.h

#######################################

#include<iostream>

#include<iomanip>

using namespace std;

class Rectangle {

       double length, width;

       public:

       Rectangle();

       Rectangle(double newLength, double newWidth);

       void setLength(double l);

       void setWidth(double w);

       double getLength();

       double getWidth();

       double computeArea();

       double computePerimeter();

       

       Rectangle operator++ ();

       Rectangle operator++ (int);

       

       Rectangle operator-- ();

       Rectangle operator-- (int);

       Rectangle operator- (Rectangle r);

       bool operator== (Rectangle r);

       bool operator!= (Rectangle r);

       

       void printDetails();

};

#######################################

           main.cpp

#######################################

#include "Rectangle.h"

       // Ask the user to type in a length and width and

       // create an object called rect2 of the rectangle class

       // See output for format

       cout << "Enter the length of rectangle 3: ";

       cin >> l;

       cout << "Enter the width of rectangle 3: ";

       cin >> w;

       Rectangle rect3(l, w);

       cout << endl;

       cout.setf(ios::fixed);

       cout.precision(1);

       // Using the member function in the class, print rect1, rect2,

       // and rect3 details in that order

       rect1.printDetails();

       rect2.printDetails();

       rect3.printDetails();

       cout << endl;

       // Print each rectangle in the format shown on the output

       cout << "Rectangle 1: " << rect1.getLength() << " X " << rect1.getWidth() << endl;

       cout << "Area: " << rect1.computeArea() << " Perimeter: " << rect1.computePerimeter() << endl;

       cout << "Rectangle 2: " << rect2.getLength() << " X " << rect2.getWidth() << endl;

       cout << "Area: " << rect2.computeArea() << " Perimeter: " << rect2.computePerimeter() << endl;

       cout << "Rectangle 3: " << rect3.getLength() << " X " << rect3.getWidth() << endl;

       cout << "Area: " << rect3.computeArea() << " Perimeter: " << rect3.computePerimeter() << endl;

       if(rect2 == rect3) {

               cout << "rectangle 2 and 3 are same." << endl;

       } else {

               cout << "rectangle 2 and 3 are not same." << endl;

       }

       cout << "After incrementing rectangle 2: ";

       rect2++;

       rect2.printDetails();

   return 0;

}

4 0
3 years ago
Which practice is the safest way to sit at a desk while typing on the computer?
qwelly [4]
Lol just lay back and unleash your gamer side
8 0
3 years ago
How efficient would a 6-bit code be in asynchronous transmission if it had 1 parity bit, 1 start bit, and 2 stop bits?
Lana71 [14]
How efficient well if we are transmitting 6bits and we need 10 to transmit the 6 bits that would be 6/10 = .6 = 60% efficient.
7 0
3 years ago
When you first turn on a computer and you don’t hear a spinning drive or fan or see indicator lights, is the problem hardware or
abruzzese [7]
It is a hardware issue. Hope it helps! 
5 0
3 years ago
Your company has just purchased an iSCSI storage array. You have installed a new iSCSI device onto your Ethernet network and you
Mars2501 [29]

Answer:

D) ISCSI Initiator

Explanation:

5 0
4 years ago
Other questions:
  • What is binary coded decimal,EBCD and ASCII
    15·1 answer
  • Wi-Fi is all around us. Is there any downside to its pervasiveness?
    11·1 answer
  • Whats the agenda for annual general meeting ??
    10·1 answer
  • The bluecross blueshield federal employee program (fep) is a(n) __________ health benefits program established by an act of cong
    8·1 answer
  • c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
    14·2 answers
  • In a database, it is possible to make changes such as font, text style, text color, line color, and background color. true false
    13·2 answers
  • Which of the following is not System Software?
    5·1 answer
  • Any device that uses light to read and write information.
    9·2 answers
  • Write a program to generate the following series 1, 3, 5, 7, 9, 11.................. 10th​
    10·1 answer
  • List and describe the 3 tasks learners can do in a Technology classroom.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!