Here is the HTML code for an "Add to Cart" button that you can use in your website or project:
<div class="container">
<button class="add-to-cart-button">
<svg
class="add-to-cart-box box-1"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="24" height="24" rx="2" fill="#ffffff" />
</svg>
<svg
class="add-to-cart-box box-2"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="24" height="24" rx="2" fill="#ffffff" />
</svg>
<svg
class="cart-icon"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="#ffffff"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="9" cy="21" r="1"></circle>
<circle cx="20" cy="21" r="1"></circle>
<path
d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"
></path>
</svg>
<svg
class="tick"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
>
<path fill="none" d="M0 0h24v24H0V0z" />
<path
fill="#ffffff"
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"
/>
</svg>
<span class="add-to-cart">Add to cart</span>
<span class="added-to-cart">Added to cart</span>
</button>
</div>
<div class="container">
<button class="add-to-cart-button">
<svg
class="add-to-cart-box box-1"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="24" height="24" rx="2" fill="#ffffff" />
</svg>
<svg
class="add-to-cart-box box-2"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="24" height="24" rx="2" fill="#ffffff" />
</svg>
<svg
class="cart-icon"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="#ffffff"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="9" cy="21" r="1"></circle>
<circle cx="20" cy="21" r="1"></circle>
<path
d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"
></path>
</svg>
<svg
class="tick"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
>
<path fill="none" d="M0 0h24v24H0V0z" />
<path
fill="#ffffff"
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"
/>
</svg>
<span class="add-to-cart">Add to cart</span>
<span class="added-to-cart">Added to cart</span>
</button>
</div>
Here is the Javascript code for an "Add to Cart" button that you can use in your website or project:
To create a pop-up display that shows "added to cart" when a user clicks the "Add to Cart" button, we need to add some JavaScript code. We can use the setTimeout() function to delay the execution of our code for a certain period of time after the user clicks the button.
addToCartButton = document.querySelectorAll(".add-to-cart-button");
document.querySelectorAll('.add-to-cart-button').forEach(function(addToCartButton) {
addToCartButton.addEventListener('click', function() {
addToCartButton.classList.add('added');
setTimeout(function(){
addToCartButton.classList.remove('added');
}, 2000);
});
});
To create a pop-up display that shows "added to cart" when a user clicks the "Add to Cart" button, we need to add some JavaScript code. We can use the setTimeout() function to delay the execution of our code for a certain period of time after the user clicks the button.
addToCartButton = document.querySelectorAll(".add-to-cart-button");
document.querySelectorAll('.add-to-cart-button').forEach(function(addToCartButton) {
addToCartButton.addEventListener('click', function() {
addToCartButton.classList.add('added');
setTimeout(function(){
addToCartButton.classList.remove('added');
}, 2000);
});
});
πTop 12 websites for remote work opportunities
β‘οΈ Pangian - https://pangian.com
β‘οΈ WeWorkRemotely - https://lnkd.in/gU4Ux_xW
β‘οΈ ARC - https://arc.dev
β‘οΈRemoteLeaf - https://remoteleaf.com/
β‘οΈ ZipRecuriter -https://lnkd.in/dYpCQU8P
β‘οΈ Indeed - https://in.indeed.com/m/
β‘οΈ Remotive - https://remotive.com
β‘οΈ JustRemote - https://justremote.co/
β‘οΈ AngelList - https://angel.co/
β‘οΈ Jobspresso - https://jobspresso.co/
β‘οΈ DailyRemote - https://dailyremote.com
β‘οΈ Working Nomads - https://lnkd.in/geSbdqVG
πTop 10 websites for freelance/part-time jobs β³
β‘οΈ Freelance - https://www.freelance.com
β‘οΈ Guru - https://www.guru.com/
β‘οΈ Upwork - https://www.upwork.com/
β‘οΈ LinkedIn - http://www.linkedin.com/
β‘οΈ Snagajob - https://www.snagajob.com/
β‘οΈ LinkedIn - http://www.linkedin.com/
β‘οΈ Solid Gigs - https://solidgigs.com
β‘οΈ ServiceScape - https://lnkd.in/guR5EV_z
β‘οΈ Craigslist - http://www.craigslist.org/
β‘οΈ CoolWorks - https://www.coolworks.co
β‘οΈ Fiverr - https://www.fiverr.com/
β‘οΈ Contena - https://www.contena.co
β‘οΈ Pangian - https://pangian.com
β‘οΈ WeWorkRemotely - https://lnkd.in/gU4Ux_xW
β‘οΈ ARC - https://arc.dev
β‘οΈRemoteLeaf - https://remoteleaf.com/
β‘οΈ ZipRecuriter -https://lnkd.in/dYpCQU8P
β‘οΈ Indeed - https://in.indeed.com/m/
β‘οΈ Remotive - https://remotive.com
β‘οΈ JustRemote - https://justremote.co/
β‘οΈ AngelList - https://angel.co/
β‘οΈ Jobspresso - https://jobspresso.co/
β‘οΈ DailyRemote - https://dailyremote.com
β‘οΈ Working Nomads - https://lnkd.in/geSbdqVG
πTop 10 websites for freelance/part-time jobs β³
β‘οΈ Freelance - https://www.freelance.com
β‘οΈ Guru - https://www.guru.com/
β‘οΈ Upwork - https://www.upwork.com/
β‘οΈ LinkedIn - http://www.linkedin.com/
β‘οΈ Snagajob - https://www.snagajob.com/
β‘οΈ LinkedIn - http://www.linkedin.com/
β‘οΈ Solid Gigs - https://solidgigs.com
β‘οΈ ServiceScape - https://lnkd.in/guR5EV_z
β‘οΈ Craigslist - http://www.craigslist.org/
β‘οΈ CoolWorks - https://www.coolworks.co
β‘οΈ Fiverr - https://www.fiverr.com/
β‘οΈ Contena - https://www.contena.co
def rec(a, b):
if a == 0:
return b
else:
return rec(a - 1, a + b)
print (rec (8, 12))
what's the output of above python code?
a)12
b)36
c)16
d)48
comment ur answer
if a == 0:
return b
else:
return rec(a - 1, a + b)
print (rec (8, 12))
what's the output of above python code?
a)12
b)36
c)16
d)48
comment ur answer
a=0
b=1
print(a or b)
what's the output of above python code?
a)1
b)0
c)0 or 1
d)a or b
comment ur answer
b=1
print(a or b)
what's the output of above python code?
a)1
b)0
c)0 or 1
d)a or b
comment ur answer
(100% FΚα΄α΄) Learn CSS β For Beginners || Learn to Work with Cascading Style Sheetsβ¦
βββββββββββββββββββ
π Enroll Linkβ https://studybullet.com/course/learn-css-for-beginners/
βββββββββββββββββββ
π· Invite Friendsβ https://t.me/smw_coding
β οΈ Free for first 500 Enrollments only.
βββββββββββββββββββ
π Enroll Linkβ https://studybullet.com/course/learn-css-for-beginners/
βββββββββββββββββββ
π· Invite Friendsβ https://t.me/smw_coding
β οΈ Free for first 500 Enrollments only.
(100% FΚα΄α΄) Learn PHP β For Beginners || Learn to create dynamic web applications usingβ¦
βββββββββββββββββββ
π Enroll Linkβ https://studybullet.com/course/learn-php-for-beginners/
βββββββββββββββββββ
π· Invite Friendsβ https://t.me/smw_coding
β οΈ Free for first 500 Enrollments only.
βββββββββββββββββββ
π Enroll Linkβ https://studybullet.com/course/learn-php-for-beginners/
βββββββββββββββββββ
π· Invite Friendsβ https://t.me/smw_coding
β οΈ Free for first 500 Enrollments only.
StudyBullet Free Courses
Learn PHP - For Beginners β StudyBullet.com
β PHP Syntax
track phone location python source code
import phonenumbers
from phonenumbers import geocoder
phone_number1=phonenumbers.parse("+916302793145")
print("\n phone numbers location \n")
print(geocoder.description_for_number(phone_number1,"en"))
output:
phone numbers location
India
[Program finished]
import phonenumbers
from phonenumbers import geocoder
phone_number1=phonenumbers.parse("+916302793145")
print("\n phone numbers location \n")
print(geocoder.description_for_number(phone_number1,"en"))
output:
phone numbers location
India
[Program finished]
some important full forms
APL : Application Programming Interface
ALGOL : ALGOrithmic Language
PHP : Hypertext Preprocessor
JSP : Java Server Pages
J2EE : Java 2 Platform Enterprise Edition
ASP : Active Server Pages
SAP : System Analysis and Programming
XML : Extensible Markup Language
AJAX : Asynchronous JavaScript And XML
Wi-Fi : Wireless Fidelity
LISP : List Processing
APK : Android Application Package
APL : Application Programming Interface
ALGOL : ALGOrithmic Language
PHP : Hypertext Preprocessor
JSP : Java Server Pages
J2EE : Java 2 Platform Enterprise Edition
ASP : Active Server Pages
SAP : System Analysis and Programming
XML : Extensible Markup Language
AJAX : Asynchronous JavaScript And XML
Wi-Fi : Wireless Fidelity
LISP : List Processing
APK : Android Application Package
python calculator source code
from tkinter import *
from math import *
root = Tk()
root.title("Calculator")
root.resizable(width=False, height=False)
screen = StringVar()
screen.set("0")
current = ""
power = ""
firstnum = str()
secondnum = str()
mathsign = str()
defxworking = False
percentt = False
def math_button_pressed():
if mathsign == '+':
button_plus.config(relief=SUNKEN)
if mathsign == '-':
button_minus.config(relief=SUNKEN)
if mathsign == '*':
button_multiply.config(relief=SUNKEN)
if mathsign == '/':
button_division.config(relief=SUNKEN)
def math_button_raised():
button_plus.config(relief=RAISED)
button_minus.config(relief=RAISED)
button_multiply.config(relief=RAISED)
button_division.config(relief=RAISED)
def is_int(num):
if int(num) == float(num):
return int(num)
else:
return float(num)
def number_pressed(butt):
global current, power, firstnum, secondnum
if mathsign == str() and defxworking == False:
current = current + str(butt)
screen.set(current)
firstnum = float(current)
elif mathsign != str() and defxworking == False:
math_button_raised()
current = current + str(butt)
screen.set(current)
secondnum = float(current)
elif mathsign == str() and defxworking == True:
power = power + str(butt)
current = current + str(butt)
screen.set(current)
elif mathsign != str and defxworking == True:
power = power + str(butt)
current = current + str(butt)
screen.set(current)
print(power)
def math_pressed(math):
global current, power, mathsign, firstnum, secondnum, defxworking, percentt
if mathsign == str() and defxworking == False and percentt == False and firstnum != str():
mathsign = str(math)
math_button_pressed()
current = ""
elif mathsign != str() and defxworking == False and percentt == False:
if mathsign == '+':
firstnum = round(float(firstnum + secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - secondnum),6)
if mathsign == '*':
firstnum = round(float(firstnum * secondnum),6)
if mathsign == '/':
firstnum = round(float(firstnum / secondnum),6)
screen.set(is_int(firstnum))
mathsign = str(math)
math_button_pressed()
current = ""
elif mathsign != str() and defxworking == True and percentt == False:
if mathsign == '+':
firstnum = round(firstnum + secondnum ** int(power),6)
if mathsign == '-':
firstnum = round(firstnum - secondnum ** int(power),6)
if mathsign == '*':
firstnum = round(firstnum * (secondnum ** int(power)),6)
if mathsign == '/':
firstnum = round(firstnum / (secondnum ** int(power)),6)
defxworking = False
screen.set(is_int(firstnum))
defxworking = False
mathsign = str(math)
math_button_pressed()
power = ""
current = ""
elif defxworking and percentt == False:
firstnum = round(firstnum ** int(power), 6)
defxworking = False
screen.set(is_int(firstnum))
mathsign = str(math)
math_button_pressed()
power = ""
current = ""
elif percentt:
if mathsign == '+':
firstnum = round(float(firstnum + firstnum/100*secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
mathsign = str(math)
from tkinter import *
from math import *
root = Tk()
root.title("Calculator")
root.resizable(width=False, height=False)
screen = StringVar()
screen.set("0")
current = ""
power = ""
firstnum = str()
secondnum = str()
mathsign = str()
defxworking = False
percentt = False
def math_button_pressed():
if mathsign == '+':
button_plus.config(relief=SUNKEN)
if mathsign == '-':
button_minus.config(relief=SUNKEN)
if mathsign == '*':
button_multiply.config(relief=SUNKEN)
if mathsign == '/':
button_division.config(relief=SUNKEN)
def math_button_raised():
button_plus.config(relief=RAISED)
button_minus.config(relief=RAISED)
button_multiply.config(relief=RAISED)
button_division.config(relief=RAISED)
def is_int(num):
if int(num) == float(num):
return int(num)
else:
return float(num)
def number_pressed(butt):
global current, power, firstnum, secondnum
if mathsign == str() and defxworking == False:
current = current + str(butt)
screen.set(current)
firstnum = float(current)
elif mathsign != str() and defxworking == False:
math_button_raised()
current = current + str(butt)
screen.set(current)
secondnum = float(current)
elif mathsign == str() and defxworking == True:
power = power + str(butt)
current = current + str(butt)
screen.set(current)
elif mathsign != str and defxworking == True:
power = power + str(butt)
current = current + str(butt)
screen.set(current)
print(power)
def math_pressed(math):
global current, power, mathsign, firstnum, secondnum, defxworking, percentt
if mathsign == str() and defxworking == False and percentt == False and firstnum != str():
mathsign = str(math)
math_button_pressed()
current = ""
elif mathsign != str() and defxworking == False and percentt == False:
if mathsign == '+':
firstnum = round(float(firstnum + secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - secondnum),6)
if mathsign == '*':
firstnum = round(float(firstnum * secondnum),6)
if mathsign == '/':
firstnum = round(float(firstnum / secondnum),6)
screen.set(is_int(firstnum))
mathsign = str(math)
math_button_pressed()
current = ""
elif mathsign != str() and defxworking == True and percentt == False:
if mathsign == '+':
firstnum = round(firstnum + secondnum ** int(power),6)
if mathsign == '-':
firstnum = round(firstnum - secondnum ** int(power),6)
if mathsign == '*':
firstnum = round(firstnum * (secondnum ** int(power)),6)
if mathsign == '/':
firstnum = round(firstnum / (secondnum ** int(power)),6)
defxworking = False
screen.set(is_int(firstnum))
defxworking = False
mathsign = str(math)
math_button_pressed()
power = ""
current = ""
elif defxworking and percentt == False:
firstnum = round(firstnum ** int(power), 6)
defxworking = False
screen.set(is_int(firstnum))
mathsign = str(math)
math_button_pressed()
power = ""
current = ""
elif percentt:
if mathsign == '+':
firstnum = round(float(firstnum + firstnum/100*secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
mathsign = str(math)
math_button_pressed()
current = ""
def squareroot():
global firstnum, secondnum, mathsign, current
if mathsign == str():
firstnum = round(sqrt(firstnum),6)
screen.set(is_int(firstnum))
if mathsign != str():
if mathsign == '+':
firstnum = round(sqrt(firstnum + float(secondnum)),6)
if mathsign == '-':
firstnum = round(sqrt(firstnum - float(secondnum)),6)
if mathsign == '*':
firstnum = round(sqrt(firstnum * float(secondnum)),6)
if mathsign == '/':
firstnum = round(sqrt(firstnum / float(secondnum)),6)
screen.set(is_int(firstnum))
secondnum = str()
mathsign = str()
current = ""
def x():
global firstnum, secondnum, mathsign, current, defxworking
if mathsign == str():
current = str(is_int(firstnum)) + '^'
screen.set(current)
defxworking = True
elif mathsign != str():
current = str(is_int(secondnum)) + '^'
screen.set(current)
defxworking = True
def result():
global firstnum, secondnum, mathsign, current, power, defxworking, percentt
if defxworking == False and percentt == False:
if mathsign == '+':
firstnum = round(float(firstnum + secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - secondnum),6)
if mathsign == '*':
firstnum = round(float(firstnum * secondnum),6)
if mathsign == '/':
firstnum = round(float(firstnum / secondnum),6)
screen.set(is_int(firstnum))
if mathsign == str() and defxworking == True and percentt == False:
firstnum = round(firstnum ** int(power),6)
defxworking = False
screen.set(is_int(firstnum))
if mathsign != str() and defxworking == True and percentt == False:
if mathsign == '+':
firstnum = round(firstnum + secondnum ** int(power),6)
if mathsign == '-':
firstnum = round(firstnum - secondnum ** int(power),6)
if mathsign == '*':
firstnum = round(firstnum * (secondnum ** int(power)),6)
if mathsign == '/':
firstnum = round(firstnum / (secondnum ** int(power)),6)
defxworking = False
screen.set(is_int(firstnum))
if defxworking == False and percentt == True:
if mathsign == '+':
firstnum = round(float(firstnum + firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
if mathsign == '-':
firstnum = round(float(firstnum - firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
if defxworking == False and mathsign == '*' or '/' and percentt == True:
clear()
mathsign = str()
current = ""
power = ""
def clear():
global current, firstnum, secondnum, mathsign, power, defxworking, percentt
screen.set(0)
current = ""
power = ""
firstnum = str()
secondnum = str()
mathsign = str()
defxworking = False
math_button_raised()
percentt = False
def percent():
global firstnum, secondnum, current, percentt
current = str(is_int(secondnum)) + '%'
screen.set(current)
percentt = True
# Widgets
calculation = Entry(root, textvariable = screen, font=("Verdana", 15, ), bd = 12,
insertwidth=4, width=14, justify=RIGHT)
calculation.grid(columnspan=4)
# Numbers
button1 = Button(root, text='1', command=lambda: number_pressed(1), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button1.grid(row=2, column=0, sticky=W)
current = ""
def squareroot():
global firstnum, secondnum, mathsign, current
if mathsign == str():
firstnum = round(sqrt(firstnum),6)
screen.set(is_int(firstnum))
if mathsign != str():
if mathsign == '+':
firstnum = round(sqrt(firstnum + float(secondnum)),6)
if mathsign == '-':
firstnum = round(sqrt(firstnum - float(secondnum)),6)
if mathsign == '*':
firstnum = round(sqrt(firstnum * float(secondnum)),6)
if mathsign == '/':
firstnum = round(sqrt(firstnum / float(secondnum)),6)
screen.set(is_int(firstnum))
secondnum = str()
mathsign = str()
current = ""
def x():
global firstnum, secondnum, mathsign, current, defxworking
if mathsign == str():
current = str(is_int(firstnum)) + '^'
screen.set(current)
defxworking = True
elif mathsign != str():
current = str(is_int(secondnum)) + '^'
screen.set(current)
defxworking = True
def result():
global firstnum, secondnum, mathsign, current, power, defxworking, percentt
if defxworking == False and percentt == False:
if mathsign == '+':
firstnum = round(float(firstnum + secondnum),6)
if mathsign == '-':
firstnum = round(float(firstnum - secondnum),6)
if mathsign == '*':
firstnum = round(float(firstnum * secondnum),6)
if mathsign == '/':
firstnum = round(float(firstnum / secondnum),6)
screen.set(is_int(firstnum))
if mathsign == str() and defxworking == True and percentt == False:
firstnum = round(firstnum ** int(power),6)
defxworking = False
screen.set(is_int(firstnum))
if mathsign != str() and defxworking == True and percentt == False:
if mathsign == '+':
firstnum = round(firstnum + secondnum ** int(power),6)
if mathsign == '-':
firstnum = round(firstnum - secondnum ** int(power),6)
if mathsign == '*':
firstnum = round(firstnum * (secondnum ** int(power)),6)
if mathsign == '/':
firstnum = round(firstnum / (secondnum ** int(power)),6)
defxworking = False
screen.set(is_int(firstnum))
if defxworking == False and percentt == True:
if mathsign == '+':
firstnum = round(float(firstnum + firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
if mathsign == '-':
firstnum = round(float(firstnum - firstnum/100*secondnum),6)
screen.set(is_int(firstnum))
percentt = False
if defxworking == False and mathsign == '*' or '/' and percentt == True:
clear()
mathsign = str()
current = ""
power = ""
def clear():
global current, firstnum, secondnum, mathsign, power, defxworking, percentt
screen.set(0)
current = ""
power = ""
firstnum = str()
secondnum = str()
mathsign = str()
defxworking = False
math_button_raised()
percentt = False
def percent():
global firstnum, secondnum, current, percentt
current = str(is_int(secondnum)) + '%'
screen.set(current)
percentt = True
# Widgets
calculation = Entry(root, textvariable = screen, font=("Verdana", 15, ), bd = 12,
insertwidth=4, width=14, justify=RIGHT)
calculation.grid(columnspan=4)
# Numbers
button1 = Button(root, text='1', command=lambda: number_pressed(1), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button1.grid(row=2, column=0, sticky=W)
button2 = Button(root, text='2', command=lambda: number_pressed(2), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button2.grid(row=2, column=1, sticky=W)
button3 = Button(root, text='3', command=lambda: number_pressed(3), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button3.grid(row=2, column=2, sticky=W)
button4 = Button(root, text='4', command=lambda: number_pressed(4), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button4.grid(row=3, column=0, sticky=W)
button5 = Button(root, text='5', command=lambda: number_pressed(5), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button5.grid(row=3, column=1, sticky=W)
button6 = Button(root, text='6', command=lambda: number_pressed(6), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button6.grid(row=3, column=2, sticky=W)
button7 = Button(root, text='7', command=lambda: number_pressed(7), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button7.grid(row=4, column=0, sticky=W)
button8 = Button(root, text='8', command=lambda: number_pressed(8), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button8.grid(row=4, column=1, sticky=W)
button9 = Button(root, text='9', command=lambda: number_pressed(9), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button9.grid(row=4, column=2, sticky=W)
button0 = Button(root, text='0', command=lambda: number_pressed(0), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button0.grid(row=5, column=0, sticky=W)
button_float = Button(root, text='.', command=lambda: number_pressed('.'), bg="gainsboro",
bd=3, padx=15, pady=5, font=("Helvetica", 14, "bold"))
button_float.grid(row=5, column=1)
# Math signs
button_plus = Button(root, text='+', command=lambda: math_pressed('+'), bg="gray70",
bd=3, padx=11, pady=5, font=("Helvetica", 14, "bold"))
button_plus.grid(row=2, column=3, sticky=W)
button_minus = Button(root, text='-', command=lambda: math_pressed('-'), bg="gray70",
bd=3, padx=11, pady=4, font=("Verdana", 14, "bold"))
button_minus.grid(row=3, column=3, sticky=W)
button_multiply = Button(root, text='*', command=lambda: math_pressed('*'), bg="gray70",
bd=3, padx=13, pady=5, font=("Helvetica", 14, "bold"))
button_multiply.grid(row=4, column=3, )
button_division = Button(root, text='/', command=lambda: math_pressed('/'), bg="gray70",
bd=3, padx=14, pady=5, font=("Helvetica", 14, "bold"))
button_division.grid(row=5, column=3, )
button_equal = Button(root, text='=', command=lambda: result(), bg='orange',
bd=3, padx=12, pady=5, font=("Arial", 14))
button_equal.grid(row=5, column=2, )
button_percent = Button(root, text='%', command=lambda: percent(), bg="gray70",
bd=3, padx=8, pady=5, font=("Helvetica", 14, "bold"))
button_percent.grid(row=1, column=3, )
button_clear = Button(root, text='C', command=lambda: clear(), bg='gray70',
bd=3, padx=11, pady=5, font=("Helvetica", 14))
button_clear.grid(row=1, column=0)
button_sqrt = Button(root, text='β', command=lambda: squareroot(), bg="gray70",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button_sqrt.grid(row=1, column=1, sticky=W)
button_x = Button(root, text='x^y', command=lambda: x(), bg="gray70",
bd=3, padx=6, pady=5, font=("Helvetica", 14))
button_x.grid(row=1, column=2, sticky=W)
root.mainloop()
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button2.grid(row=2, column=1, sticky=W)
button3 = Button(root, text='3', command=lambda: number_pressed(3), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button3.grid(row=2, column=2, sticky=W)
button4 = Button(root, text='4', command=lambda: number_pressed(4), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button4.grid(row=3, column=0, sticky=W)
button5 = Button(root, text='5', command=lambda: number_pressed(5), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button5.grid(row=3, column=1, sticky=W)
button6 = Button(root, text='6', command=lambda: number_pressed(6), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button6.grid(row=3, column=2, sticky=W)
button7 = Button(root, text='7', command=lambda: number_pressed(7), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button7.grid(row=4, column=0, sticky=W)
button8 = Button(root, text='8', command=lambda: number_pressed(8), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button8.grid(row=4, column=1, sticky=W)
button9 = Button(root, text='9', command=lambda: number_pressed(9), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button9.grid(row=4, column=2, sticky=W)
button0 = Button(root, text='0', command=lambda: number_pressed(0), bg="gainsboro",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button0.grid(row=5, column=0, sticky=W)
button_float = Button(root, text='.', command=lambda: number_pressed('.'), bg="gainsboro",
bd=3, padx=15, pady=5, font=("Helvetica", 14, "bold"))
button_float.grid(row=5, column=1)
# Math signs
button_plus = Button(root, text='+', command=lambda: math_pressed('+'), bg="gray70",
bd=3, padx=11, pady=5, font=("Helvetica", 14, "bold"))
button_plus.grid(row=2, column=3, sticky=W)
button_minus = Button(root, text='-', command=lambda: math_pressed('-'), bg="gray70",
bd=3, padx=11, pady=4, font=("Verdana", 14, "bold"))
button_minus.grid(row=3, column=3, sticky=W)
button_multiply = Button(root, text='*', command=lambda: math_pressed('*'), bg="gray70",
bd=3, padx=13, pady=5, font=("Helvetica", 14, "bold"))
button_multiply.grid(row=4, column=3, )
button_division = Button(root, text='/', command=lambda: math_pressed('/'), bg="gray70",
bd=3, padx=14, pady=5, font=("Helvetica", 14, "bold"))
button_division.grid(row=5, column=3, )
button_equal = Button(root, text='=', command=lambda: result(), bg='orange',
bd=3, padx=12, pady=5, font=("Arial", 14))
button_equal.grid(row=5, column=2, )
button_percent = Button(root, text='%', command=lambda: percent(), bg="gray70",
bd=3, padx=8, pady=5, font=("Helvetica", 14, "bold"))
button_percent.grid(row=1, column=3, )
button_clear = Button(root, text='C', command=lambda: clear(), bg='gray70',
bd=3, padx=11, pady=5, font=("Helvetica", 14))
button_clear.grid(row=1, column=0)
button_sqrt = Button(root, text='β', command=lambda: squareroot(), bg="gray70",
bd=3, padx=12, pady=5, font=("Helvetica", 14, "bold"))
button_sqrt.grid(row=1, column=1, sticky=W)
button_x = Button(root, text='x^y', command=lambda: x(), bg="gray70",
bd=3, padx=6, pady=5, font=("Helvetica", 14))
button_x.grid(row=1, column=2, sticky=W)
root.mainloop()
#calculate the chicken rate
n_Gram = int(input("enter the weigth of grams : "))
cost = int(input("enter the cost value: "))
one_GramCost = cost/1000
print("the {} grams weight is {} ".format(n_Gram,one_GramCost*n_Gram))
n_Gram = int(input("enter the weigth of grams : "))
cost = int(input("enter the cost value: "))
one_GramCost = cost/1000
print("the {} grams weight is {} ".format(n_Gram,one_GramCost*n_Gram))
#turtleprograms
program 01
source code
input:
#Square Spiral
from turtle import*
for i in range(20):
forward(i*10)
right(90)
done()
output:
program 01
source code
input:
#Square Spiral
from turtle import*
for i in range(20):
forward(i*10)
right(90)
done()
output:
#turtleprograms
program 01
source code
input:
#star program
from turtle import*
for i in range(5):
forward(100)
right(144)
done()
output:
program 01
source code
input:
#star program
from turtle import*
for i in range(5):
forward(100)
right(144)
done()
output:
#turtleprograms
program 01
source code
input:
#Spirograph program
from turtle import*
speed(200)
for i in range(72):
circle(100)
right(5)
done()
output:
program 01
source code
input:
#Spirograph program
from turtle import*
speed(200)
for i in range(72):
circle(100)
right(5)
done()
output:
#turtleprograms
program 01
source code
input:
#Sunburst program
from turtle import*
for i in range(36):
forward(50)
backward(100)
right(10)
done()
output:
program 01
source code
input:
#Sunburst program
from turtle import*
for i in range(36):
forward(50)
backward(100)
right(10)
done()
output:
----------------------------------
Python Basic programs starting to advanced programs all uploading
Python Basic programs starting to advanced programs all uploading