What is your question? I’ll try my best to help
Answer:
Explanation:
Let's do this in Python, first we need to convert the number into string in order to break it into a list of character, then we can replace the kth character with d. Finally we join all characters together, convert it to integer then output it
def setKthDigit(n, k, d):
n_string = str(n)
d_char = str(d)
n_char = [c for c in n_string]
n_char[k] = d_char
new_n_string = ''.join(n_char)
return int(new_n_string)
Answer:
Check the explanation
Explanation:
use `my_guitar_shop`;
#delete the procedure test if it exists.
DROP PROCEDURE IF EXISTS test;
DELIMITER //
CREATE PROCEDURE test ()
BEGIN
#declare variable sqlerr to store if there is an sql exception
declare sqlerr tinyint default false;
#declare variable handler to flag when duplicate value is inserted
declare continue handler for 1062 set sqlerr = TRUE;
#start transaction
start transaction;
delete from order_items where order_id in
(select order_id from orders where customer_id=6);
delete from orders where customer_id=6;
delete from addresses where customer_id=6;
delete from customers where customer_id=6;
if sqlerr=FALSE then
commit;
select 'Transaction Committed' as msg;
else
rollback;
select 'Transaction rollbacked' as msg;
end if;
end //
delimiter ;
call test();