using System;
using System.Diagnostics;
using System.Collections.Generic;
public class Tarjeta {
public /*required*/ int Num {
get => this._num;
init {
Debug.Assert( value > 0, "num. de tarjeta debe ser positivo" );
this._num = value;
this.calculaCVC();
}
}
public /*required*/ DateOnly Caduca {
get => this._caduca;
init {
Debug.Assert( value > DateOnly.FromDateTime( DateTime.Now ), "caducidad debe ser a futuro" );
this._caduca = value;
}
}
public int CVC { get; private set; }
public Tarjeta(int num, DateOnly caduca)
{
Debug.Assert( num > 0, "num. de tarjeta debe ser positivo" );
Debug.Assert( caduca > DateOnly.FromDateTime( DateTime.Now ), "caducidad debe ser a futuro" );
this.Num = num;
this.Caduca = caduca;
this.calculaCVC();
}
private void calculaCVC()
{
this.CVC = this.Num % 1000;
}
public override string ToString()
{
return $"{this.Num} ({this.Caduca}, {this.CVC})";
}
private int _num;
private DateOnly _caduca;
}
public class Test
{
public static void Main()
{
/*
var t1 = new Tarjeta {
Num = 548901687,
Caduca = new DateOnly( 2034, 11, 5 )
};
*/
var t2 = new Tarjeta( 548901687, new DateOnly( 2034, 11, 5 ) );
// Console.WriteLine( t1 );
Console.WriteLine( t2 );
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljOwoKCnB1YmxpYyBjbGFzcyBUYXJqZXRhIHsKCXB1YmxpYyAvKnJlcXVpcmVkKi8gaW50IE51bSB7CgkJZ2V0ID0+IHRoaXMuX251bTsKCQlpbml0IHsKCQkJRGVidWcuQXNzZXJ0KCB2YWx1ZSA+IDAsICJudW0uIGRlIHRhcmpldGEgZGViZSBzZXIgcG9zaXRpdm8iICk7CgkJCXRoaXMuX251bSA9IHZhbHVlOwoJCQl0aGlzLmNhbGN1bGFDVkMoKTsKCQl9Cgl9CgkKCXB1YmxpYyAvKnJlcXVpcmVkKi8gRGF0ZU9ubHkgQ2FkdWNhIHsKCQlnZXQgPT4gdGhpcy5fY2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F0ZU9ubHkoIDIwMzQsIDExLCA1ICkKCQl9OwoJKi8JCgkJdmFyIHQyID0gbmV3IFRhcmpldGEoIDU0ODkwMTY4NywgbmV3IERhdGVPbmx5KCAyMDM0LCAxMSwgNSApICk7CgkJCgkJLy8gQ29uc29sZS5Xcml0ZUxpbmUoIHQxICk7CgkJQ29uc29sZS5Xcml0ZUxpbmUoIHQyICk7Cgl9Cn0K
aW1wb3J0IHRpbWUKCmZyb20gc2VsZW5pdW0gaW1wb3J0IHdlYmRyaXZlcgpmcm9tIHNlbGVuaXVtLndlYmRyaXZlci5jb21tb24uYnkgaW1wb3J0IEJ5Cgpkcml2ZXIgPSB3ZWJkcml2ZXIuRmlyZWZveCgpCgpkcml2ZXIuZ2V0KCZxdW90O2h0dHBzOi8vZC4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uYS5jb20vYXV0b21hdGlvbi1wcmFjdGljZS1mb3JtJnF1b3Q7KQpkcml2ZXIubWF4aW1pemVfd2luZG93KCkKCmZpcnN0TmFtZSA9IGRyaXZlci5maW5kX2VsZW1lbnQoQnkuQ1NTX1NFTEVDVE9SLCAmcXVvdDtpbnB1dCNmaXJzdE5hbWUubXItc20tMi5mb3JtLWNvbnRyb2wmcXVvdDspCgpmaXJzdE5hbWUuc2VuZF9rZXlzKCZxdW90O1lhc3dhbnRoJnF1b3Q7KQoKbGFzdE5hbWUgPSBkcml2ZXIuZmluZF9lbGVtZW50KEJ5LkNTU19TRUxFQ1RPUiwmcXVvdDtpbnB1dCNsYXN0TmFtZS5tci1zbS0yLmZvcm0tY29udHJvbCZxdW90OykKCmxhc3ROYW1lLnNlbmRfa2V5cygmcXVvdDtHdWRpdmFkYSZxdW90OykKCnRpbWUuc2xlZXAoNSkKCmRyaXZlci5jbG9zZSgp
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Firefox()
driver.get("https://d...content-available-to-author-only...a.com/automation-practice-form")
driver.maximize_window()
firstName = driver.find_element(By.CSS_SELECTOR, "input#firstName.mr-sm-2.form-control")
firstName.send_keys("Yaswanth")
lastName = driver.find_element(By.CSS_SELECTOR,"input#lastName.mr-sm-2.form-control")
lastName.send_keys("Gudivada")
time.sleep(5)
driver.close()