Здравствуйте, уважаемые программисты Учусь в 11 классе, раньше проходила С++, сейчас новый учитель переучивает на Python. Решить данную задачу я на Python не смогла.. Помогите, пожалуйста!
Условие:
Решение на С++
#include<iostream>
class Mail{
private:
std::string box, server;
public:
Mail(std::string s){
SetMail(s);
}
void SetMail(std::string s){
std::string::size_type ind=s.find('@');
box.assign(&s, &s);
server.assign(&s, &s);
}
std::string GetMail()const{
return box+“@”+server;
}
void SetBox(std::string s){
box=s;
}
void SetServer(std::string s){
server=s;
}
};
int main(){
Mail a(“mybox@mail.ru”);
std::cout<<a.GetMail()<<“\n”;
a.SetBox(“myotherbox”);
std::cout<<a.GetMail()<<“\n”;
a.SetServer(“yandex.ru”);
std::cout<<a.GetMail()<<“\n”;
}