Posts

Showing posts from August, 2021

java script old

 <script> // Find out the cart items from localStorage if (localStorage.getItem('cart') == null) {     var cart = {}; } else {     cart = JSON.parse(localStorage.getItem('cart'));     document.getElementById('cart').innerHTML = Object.keys(cart).length;     updateCart(cart); } // If the add to cart button is clicked, add/increment the item function addToCart(event){   // $('.divpr').on('click', 'button.cart', function(){     var idstr = event.target.id;     if (cart[idstr] != undefined) {          qty = cart[idstr][0] + 1;     }      else {         qty = 1;         name = document.getElementById('name'+idstr).innerHTML         price = document.getElementById('price'+idstr).innerHTML         cart[idstr] = [qty, name,price];     }     updateCart(cart);    ...

my dictionary using python

  #my dictonary    dictionary ={ "abbas" : "name" , "pizza" : "thing" , "loki" : "ve" , "bol" : "word" }     a = input ( "Enter a word " ) print ( dictionary [ a ])

faulty calculator using python

  # 45 * 3 = 555, 56+9 = 77, 56/6 = 4 print ( ''' choose opeartor: 1.add 2.sub 3.mul 4.div ''' ) operator = input ( "enter a operator serial number " ) n1 = int ( input ( "enter a number " )) n2 = int ( input ( "enter a number " )) if   operator == '1' :      result = n1 + n2 elif   operator == '2' :      result = n1 - n2 elif   operator == '3' :      result = n1 * n2 elif   operator == '4' :      result = n1 / n2 if   result == 45  *  3 :      result = 555       elif   result == 56 + 9 :      result = 77 elif   result == 56 / 6  :      result = 4

guess game using python

  # guess game  print ( "welcome to guessing game " ) print ( "  --- You have total 4 guesses to guess the number --- " ) hidden_number = 72 i = 1 while ( i <= 4 ):      guess_number = int ( input ( "Enter number "  ))      print ( "guesses done " , i )      if ( hidden_number == guess_number ):          print ( "you have guessed the correct number" )          break           elif ( guess_number < 72 ):          print ( "you need to guess a higher number" )      elif ( guess_number > 72 ):             print...

my index2 page

 {% extends 'shop/basic.html' %} {% block title%}MARTISTERY-Best Phone covers.  {% endblock %} <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@1,100&display=swap" rel="stylesheet"> {% block css %}           .col-md-3           {           display: inline-block;           margin-left:-4px;           }           .carousel-indicators .active {           background-color: blue;             }           .col-md-3 img{           max-width: 191px;         height: 200px;         position: relative;        ...

java script for cart

  {% block js %} <script> // Find out the cart items from localStorage if(localStorage.getItem('cart') == null){ var cart = {}; } else { cart = JSON.parse(localStorage.getItem('cart')); document.getElementById('cart').innerHTML = Object.keys(cart).length; updateCart(cart); } // If the add to cart button is clicked, add/increment the item $('.divpr').on('click', 'button.cart', function() {     var idstr = this.id.toString();     if (cart[idstr] != undefined)      {         qty = cart[idstr][0] + 1;                     }      else      {         qty = 1;         name = document.getElementById('name'+idstr).innerHTML         price = document.getElementById('price'+idstr).innerHTML                  cart[idstr] = [qty, name,parseInt(price)]...