python

how do I fix this error I am getting

code:

from tkinter import *
expression = ""

def press(num):
global expression
expression = expression + str(num)
equation.set(expression)

def equalpress():
try:
global expression
total = str(eval(expression))
equation.set(total)
expression = ""

except:
equation.set(" error ")
expression = ""

def clear():
global expression
expression = ""
equation.set("")


equation.set("")

if __name__ == "__main__":
gui = Tk()



gui.geometry("270x150")

equation = StringVar()

expression_field = Entry(gui, textvariable=equation)

expression_field.grid(columnspan=4, ipadx=70)


buttonl = Button(gui, text=' 1', fg='black', bg='white',command=lambda: press(1), height=l, width=7)
buttonl.grid(row=2, column=0)

button2 = Button(gui, text=' 2', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button2.grid(row=2, column=1)

button3 = Button(gui, text=' 3', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button3.grid(row=2, column=2)

button4 = Button(gui, text=' 4', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button4.grid(row=3, column=0)
button5 = Button(gui, text=' 5', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button5.grid(row=3, column=1)
button6 = Button(gui, text=' 6', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button6.grid(row=3, column=2)
button7 = Button(gui, text=' 7', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button7.grid(row=4, column=0)
button8 = Button(gui, text=' 8', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button8.grid(row=4, column=1)
button9 = Button(gui, text=' 9', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button9.grid(row=4, column=2)
button0 = Button(gui, text=' 0', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
button0.grid(row=5, column=0)


Add = Button(gui, text=' +', fg='black', bg='white',command=lambda: press("+"), height=l, width=7)
Add.grid(row=2, column=3)

Sub = Button(gui, text=' -', fg='black', bg='white',command=lambda: press(2), height=l, width=7)
Sub.grid(row=3, column=3)

Div = Button(gui, text=' /', fg='black', bg='white',command=lambda: press("/"), height=l, width=7)
Div.grid(row=5, column=3)

Mul = Button(gui, text=' *', fg='black', bg='white',command=lambda: press("*"), height=l, width=7)
Mul.grid(row=4, column=3)

Equal = Button(gui, text=' =', fg='black', bg='white',command=equalpress, height=l, width=7)
Equal.grid(row=5, column=2)

Clear = Button(gui, text=' Clear', fg='black', bg='white',command=clear, height=l, width=7)
Clear.grid(row=5, column=1)

Decimal = Button(gui, text=' .', fg='black', bg='white',command=lambda: press("."), height=l, width=7)
buttonl.grid(row=6, column=0)

gui.mainloop()

Answers

Answer 1

Answer:

from tkinter import *

expression = ""

def press(num):

global expression

expression = expression + str(num)

equation.set(expression)

def equalpress():

try:

 global expression

 total = str(eval(expression))

 equation.set(total)

 expression = ""

except:

 equation.set(" error ")

 expression = ""

def clear():

global expression

expression = ""

equation.set("")

if __name__ == "__main__":

gui = Tk()

 

equation = StringVar(gui, "")

equation.set("")

gui.geometry("270x150")

expression_field = Entry(gui, textvariable=equation)

expression_field.grid(columnspan=4, ipadx=70)

buttonl = Button(gui, text=' 1', fg='black', bg='white',command=lambda: press(1), height=1, width=7)

buttonl.grid(row=2, column=0)

button2 = Button(gui, text=' 2', fg='black', bg='white',command=lambda: press(2), height=1, width=7)

button2.grid(row=2, column=1)

button3 = Button(gui, text=' 3', fg='black', bg='white',command=lambda: press(3), height=1, width=7)

button3.grid(row=2, column=2)

button4 = Button(gui, text=' 4', fg='black', bg='white',command=lambda: press(4), height=1, width=7)

button4.grid(row=3, column=0)

button5 = Button(gui, text=' 5', fg='black', bg='white',command=lambda: press(5), height=1, width=7)

button5.grid(row=3, column=1)

button6 = Button(gui, text=' 6', fg='black', bg='white',command=lambda: press(6), height=1, width=7)

button6.grid(row=3, column=2)

button7 = Button(gui, text=' 7', fg='black', bg='white',command=lambda: press(7), height=1, width=7)

button7.grid(row=4, column=0)

button8 = Button(gui, text=' 8', fg='black', bg='white',command=lambda: press(8), height=1, width=7)

button8.grid(row=4, column=1)

button9 = Button(gui, text=' 9', fg='black', bg='white',command=lambda: press(9), height=1, width=7)

button9.grid(row=4, column=2)

button0 = Button(gui, text=' 0', fg='black', bg='white',command=lambda: press(2), height=1, width=7)

button0.grid(row=5, column=0)

Add = Button(gui, text=' +', fg='black', bg='white',command=lambda: press("+"), height=1, width=7)

Add.grid(row=2, column=3)

Sub = Button(gui, text=' -', fg='black', bg='white',command=lambda: press("-"), height=1, width=7)

Sub.grid(row=3, column=3)

Div = Button(gui, text=' /', fg='black', bg='white',command=lambda: press("/"), height=1, width=7)

Div.grid(row=5, column=3)

Mul = Button(gui, text=' *', fg='black', bg='white',command=lambda: press("*"), height=1, width=7)

Mul.grid(row=4, column=3)

Equal = Button(gui, text=' =', fg='black', bg='white',command=equalpress, height=1, width=7)

Equal.grid(row=5, column=2)

Clear = Button(gui, text=' Clear', fg='black', bg='white',command=clear, height=1, width=7)

Clear.grid(row=5, column=1)

Decimal = Button(gui, text=' .', fg='black', bg='white',command=lambda: press("."), height=1, width=7)

Decimal.grid(row=6, column=0)

gui.mainloop()

Explanation:

I fixed several other typos. Your calculator works like a charm!

Pythonhow Do I Fix This Error I Am Gettingcode:from Tkinter Import *expression = "" Def Press(num): Global

Related Questions

what is peopleware?
need help​

Answers

Answer:

Peopleware is a term used to refer to one of the three core aspects of computer technology, the other two being hardware and software.

Select the correct answer.
Which formula below will return the same result as the formula =SUM(B1:B5)?

A.
=B1+B5
B.
=B1+B2+B3+B4+B5
C.
=B1,B2,B3,B4,B5
D.
=B1,B5
E.
=#B1:#B5

Answers

D because of the sun

A two-dimensional array is essentially?
A primitive date type
A looped data structure

Answers

Answer:

A looped data structure

Explanation:

A two-dimensional array is an array of another array. You can traverse it using nested loops, one to traverse row and one to traverse columns.

What is one similarity between compiled and interpreted programming languages? (5 points)

Both compiled and interpreted languages are translated one line of code at a time before moving to the next line.

Both compiled and interpreted languages can be shared with others while keeping the source code private.

Both compiled and interpreted languages are high-level languages and translate code for a computer to understand.

There are no similarities between compiled and interpreted programming languages.

Answers

Answer:

Both compiled and interpreted languages are high-level languages and translate code for a computer to understand.

Explanation:

The one similarity between compiled and interpreted languages is that they are both high-level languages.

A high-level language is a computer language written in easy to understand human language which is then converted to machine code for the computer to understand.  

A high-level language can either be interpreted or compiled.

An interpreted is a language in which the code is translated line by line before execution while a compiled language is one in which the source code is converted directly into machine language before execution.

So, the similarity between both languages is that they are high level languages and translate code for a computer to understand.

When attaching a file or files in outlook 365 you select the attach command and then select the files location

Answers

Answer:

When you click the attachment button a window pops up allowing you to select the file/s you want to upload

You can also drag and drop file/s this is an alternative method

Explanation:

Microsoft Outlook is a personal information manager software system from Microsoft.

Though primarily an email client, Outlook also includes such functions as calendaring, task managing, contact managing, note-taking, journal logging, and web browsing. Wikipedia

Running the Disk Cleanup utility is a quick way to ________. Group of answer choices defrag your hard drive remove spyware programs clear out temporary Internet files uninstall unwanted apps

Answers

Answer:

Clear out any garbage file on the drive

Explanation:

Running the Disk Cleanup utility is a quick way to clear out temporary Internet files. Therefore option C is correct.

Running the Disk Cleanup utility is a quick and efficient way to clear out temporary files and unnecessary data from your computer's hard drive.

These files can accumulate over time from web browsing, software installations, and system updates, occupying valuable disk space and potentially slowing down your system.

The Disk Cleanup tool identifies and deletes temporary internet files, cached data, downloaded program files, and other unnecessary files, freeing up space and improving system performance.

However, it is important to note that Disk Cleanup does not defragment your hard drive (A), remove spyware programs (B), or uninstall unwanted apps (D), as these tasks require different tools or procedures.

Therefore option C is correct.

Know more about Disk Cleanup:

https://brainly.com/question/31937611

#SPJ6

defination of Wi-Fi plz​

Answers

Answer:

A facility allowing computers,smartphones and other devices to connect to the internet or communicate with one another wirelessly.

Write an expression that evaluates to true if the value of the int variable widthOfBox is not divisible by the value of the int variable widthOfBook. Assume that widthOfBook is not zero. ("Not divisible" means has a remainder.)

Answers

Answer:

The expression is:

if widthOfBox % widthOfBook != 0

Explanation:

Given

Variables:

(1) widthOfBox and

(2) widthOfBook

Required

Statement that checks if (1) is divisible by (2)

To do this, we make use of the modulo operator. This checks if (1) is divisible by 2

If the result of the operation is 0, then (1) can be divided by (2)

Else, (1) can not be divided by (2)

From the question, we need the statement to be true if the numbers are not divisible.

So, we make use of the not equal to operator alongside the modulo operator

pls help it’s on a test!! no links :) you can zoom in if hard to read

Answers

Answer:

the last one

Explanation:

the domain specifies exactly what file is requested the path specifies where the browsers request should be sent

When browsing using certain browsers, if a page is known to be malicious or using phishing techniques in the past a browser may display a _________ before allowing you to move forward. Select one: Red Flashing Lights Red X Warning Bell Warning Page

Answers

Answer:

the last option

warning page

compare shopping centre and open -air market​

Answers

Answer:

The similarities between a shopping center and an open-air market are;

1. Goods are bought and sold in both a shopping center and an open-air market

2. The stores within the location have different owners

3. Buyers can move between stores for transactions

The differences between a shopping center and an open-air market are;

1) The shopping center is usually roofed, while an open-air market is usually located outdoors

2) The stores in a shopping center more often have a checkout point, while stores in an open-air market rarely make use of a checkout

3) Items found with a defect after purchase can usually be returned for a replacement in a shopping center, while it is necessary to check an item well when buying from an open-air market as returning such items is usually difficult

Explanation:

A shopping center is a complex or area that have several shop groups built together which can all be located under a roof

Professional offices, restaurants, banks, theaters, and pharmacy's  can also be located in a shopping center

Open-air market is a place in the public used for the sale of food and merchandise

I got a question in computer science I don't understand, can someone please help.​

Answers

Answer:

Hi, this program allows you to calculate a sphere’s area and volume depending on the radius of your choosing.

Please give brainliest, means alot!

I will give free brainiest if you guess my favorite car among these 3

Corvette
LaFerrari
Porsche

Answers

Answer:

LaFerrari

Explanation:

An IT suspects that an unauthorized device is connected to a wireless network. This is a result of passkey sharing on a device brought from home. What is put in place to stop such activity

Answers

Answer:

In the router settings you can just block/ban/remove access to the unauthorized device.

can someone's answer this​

Answers

Answer:

See explanation

Explanation:

Required

The surface area of each shape

Triangle

[tex]Area = \frac{1}{2}bh[/tex]

[tex]b\to base; h \to height[/tex]

So:

[tex]Area = \frac{1}{2} * 23 * 21[/tex]

[tex]Area = 241.5m^2[/tex]

Square

[tex]Area = l^2[/tex]

[tex]l \to length[/tex]

So:

[tex]Area = 10^2[/tex]

[tex]Area = 100m^2[/tex]

Rhombus

[tex]Area =a^2\sin(\theta)[/tex]

[tex]a \to side\ length[/tex]

[tex]\theta \to any\ interior\ angle[/tex] (not given)

So:

[tex]Area =18^2\sin(\theta)[/tex]

[tex]Area =324\sin(\theta)[/tex]

Trapezium

[tex]Area = \frac{1}{2}(a + b)*h[/tex]

[tex]a,b \to parallel\ sides; h \to height[/tex]

So:

[tex]Area = \frac{1}{2}(18 + 23)*21[/tex]

[tex]Area = \frac{1}{2}*41*21[/tex]

[tex]Area = 430.5m^2[/tex]

Circle

[tex]Area = \frac{\pi d^2}{4}[/tex]

[tex]d \to diameter[/tex]

So:

[tex]Area = \frac{3.14 * 5^2}{4}[/tex]

[tex]Area = \frac{3.14 * 25}{4}[/tex]

[tex]Area = \frac{78.5}{4}[/tex]

[tex]Area = 19.625m^2[/tex]

what is processing for a computer?​

Answers

Answer:

is an action or series of actions that a microprocessor, also known as a central processing unit (CPU), in a computer performs when it receives information.

Alvin has created a non-extensive site map of all the commonly visited pages of his website. What is such a site map called?

А. XML site map

B. simple site map

C. standard site map

D. HTML site map

E. advanced site map

Answers

Answer:

А. XML site map

Explanation:

Indeed, the XML site map is the modern term used to describe a non-extensive site map containing details such as the commonly visited pages of a website.

Alvin's XML site map would allow search engines to have a  record of commonly visited pages of his website.

You are an administrator with 550 devices to enroll into Intune. You choose to bulk enroll them. Which other software will you need to build the package necessary to bulk enroll the devices via USB or network location

Answers

Answer: Windows Configuration Designer (WCD)

Explanation:

The other software that will be needed to build the package which is vital in bulk enroll the devices through USB or network location is Windows Configuration Designer (WCD).

Windows Configuration Designer typically allows the configuration of several aspects of Windows devices such as Active Directory, Connect to WiFi, Device name, and install applications.

What type of communication takes place between two individuals or parties and involves the use of encryption so that only the desired individuals have access to what is being said or heard

Answers

Answer:

private

Explanation:

1.Choose the best answer.:
 a) Broadly, computers are of ................ purpose and ................ purpose
     (i) specific, general     (ii) specific, broad    (iii) precise, broad     (iv) None of them
 b) .................. computers works on continuous signals
 (i) Analog     (ii) Digital    (iii) PS/2        (iv) None of them
 c) ................ computers are the largest and most expensive digital computers.
 (i) Mainframe        (ii) Mini    (iii) Super        (iv) Apple 
d) .................. is the example of mainframe computer.
 (i) CYBER 205    (ii) IBM 3081        (iii) VAX        (iv) IBM 9375
 e) Macintosh is the OS used in .................. computer.
 (i) IBM        (ii) mainframe        (iii) super    (iv) apple
 f) .............. was mainframe computer brought first time to process census data in Nepal.
 i) IBM 1400        ii) IBM1401        iii) IBM1402 
g) ……… computer are used in hospital for Ultra Sound.
 i) Analog    ii) Digital        iii)Laptop    iv) Hybrid 
h) Nowadays, most powerful super commuter is Sunway taihulight from .......................
 i) India    ii) Germany         iii) China    iv) Nepal

Answers

Answer:

specific, generaldigitalminiCYBER 205IBMIBM1401digitalGermany


What is required when opening a checking account?
A. A credit card
B. A salary
C. A copy of your last paycheck
D. An initial deposit

Answers

Answer:

it's D

Explanation: i had this question before and i got it right :)

Answer:

D. An initial deposit

Explanation: Hope this helps :)

Is 10 teraflops good? How much does the best PC in the world have?​

Answers

Yeah it’s pretty good. The system, built by Fujitsu for Japan's RIKEN Center for Computational Science, posted a maximum sustained performance level of 442,010 teraflops per second on the Linpack benchmark.

which of the following has the highest storage capacity?
a.digital versatile disc
b.computer disc
c.floppy disk
d.hard disk

Answers

Answer:

d. Hard disk

Explanation:

The storage capacity of the given options are presented as follows;

[tex]\begin{array}{lr}Device& Storage \ Capacity\\ Digital \ versatile \ disc\ (DVD)& 4.7 \ GB\\ \begin {flushleft} Computer \ disc \ (CD)&703 \ MB\\Floppy \ disk & 2.8 \ MB\\Hard \ disk & 1,000 \ GB\end{array}\right][/tex]

Therefore, the device with the highest storage capacity from among the options is the hard disk with a storage capacity of 1,000 gigabytes of data

PLEASE HELP !!!! 40 POINTS BUT HELP

Write a python program to build a simple BMI calculator, where your program asks the user to input the height and the weight of the user then displays the BMI and statement stating the overall health of each user . All the data should be in variables , and no functions should be used.
The program should contain the following:
Welcome message- Display your full name, project name and give a small description on your project (definition of the BMI) [2 marks]
Variables :
height variable , input by the user [2 marks]
Weight variable , input by the user [2 marks]
Use a proper data type change function , int() or float() [2 marks]
Calculate the BMI by using the input variables of the height and the weight . [4 marks]
Display the BMI with statement based on the result of the BMI , refer to the below table [6 marks]
Critical thinking :
After running the code, don't stop the program and ask the user for a new input for a new calculation .(use loop , Break )
EXAMPLE :
Do you want to make a new calculation ? if no end the program , if yes start the code again .[2 marks]

Answers

Answer:

So in a way it is about a python calculation

this is used to copy information from cell to cell in the spread sheet

A. active cell
B. Auto fit
C. Grid lines
D. Fill handle

please help me with this

Answers

Answer:

D. Fill handle

Explanation:

Required

Which can be used to copy from cell to cell

(a); Means the current cell being selected in the spreadsheet program

(b): Used to fit all columns in the spreadsheet program. Usually, the columns are fitted based on their width.

(c): The vertical and horizontal lines that separate cells.

(d): This is used to copy from one cell to another, especially adjacent cells.

Which elements most affect the voice of an academic paper? Check all that apply.

Answers

where are the options

Answer:

C

Explanation:

what is file management?can please help me​

Answers

is the process of administering a system that correctly handles digital data. also i think it improves the overall function of a business workflow. but this could be totally wrong.
File Management includes common operations performed on files or groups of files, include creating, opening, renaming, moving or copying, deleting and searching for files, as well as modifying file attributes, properties and file permissions

…….. and ……...are called binary digits. (Computer Science)

Answers

Answer:

Explanation:

0 and 1 are called binary digits.

here is your answer..

Write a program to accept radius and find area of circle

Answers

Answer:

Change it however you'd like

Explanation:

from math import pi

def findArea(rad):

   return (rad**2) * pi

#test

print(f"Area of the circle: {findArea(5)}")

Answer:

the answer above me is correct

Explanation:

Select the correct answer from each drop-down menu.
Complete the sentence about uses of spreadsheets.

Two of the most common uses of spreadsheets are to _____ data and _____ data.

First blank
1. Create new
2. Search for
3. Store available

Second blank
1.Sort
2. Classify
3. Download

Answers

I think it’s 1, 2 and if im wrong im sorry

Two of the most common uses of spreadsheets are to create new data and classify data. Thus, the correct options for this question are A and B respectively.

What are the uses of Spreadsheet?

The uses of spreadsheets are as follows:

It is used to collect and store data that is systematically organized.It authorizes users in order to make calculations with the stored data.Spreadsheets are also used to make charts and graphs.It actively supports users in data sifting and cleanup.

According to the context of this question, apart from the above top uses of spreadsheets, there are other various uses that can be delivered by this platform to the user that make their professional work more efficient, organized, and attractive.

Therefore, the most common uses of spreadsheets are to create new data and classify data. Thus, the correct options for this question are A and B respectively.

To learn more about Spreadsheets, refer to the link:

https://brainly.com/question/26919847

#SPJ2

Other Questions
On Tuesday afternoon at camp, Connor did archery and sailing before dinner. Archery started at 12:00 P.M. Connor spent 1 hour and 15 minutes at archery and 2 hours sailing. What time did sailing end? The "beginning of the end" or "turning point" for the US withdrawal from South Vietnam was in response to which of the following -A) NAACP organizationB) NAFTA obstructionsC) TET OffensiveD) SEAC treaty violation plsss helpp i really need this now thank u Style manuals help the writer _____.A. find an organizational pattern for his or her paperB. locate research sources for his or her topicC. publish his or her work in a magazineD. determine the format for a specific citation please help me in the passage of find out opposite meaning cheerfulsatupstraightimproperworse The formula =average(B1:B2) displays the value____(see the picture down) The two windows shown are similar. What is the height of the larger window? 2d. Identify the extent to which skeletons are reliable sources of evidence for understanding civilizations in the Americas pre-1600 by circling reliable, somewhat reliable, or unreliable, then explain why you chose that option. Courtney would like to buy a new phone for $680. So far, she has saved $240. If she earns $8 an hourbabysitting, how many hours will she need to work to be able to buy the phone? on what factors, current sensitivity voltage sensitivity ofa galvanometer depend? All operating expenses are paid in cash in the month incurred. If HDC expects to sell 20,000 units of inventory, the total budgeted selling and administrative expenses would be what amount on the January pro forma income statement 2,5,9,15 order from least to greatest A beam strikes an irregular mirror and is reflected as shown below. The angle formed by the incoming beam and the reflected beam is 10 degrees. What is the angle of the mirror's surface (measured against vertical) at the location where the beam strikes the mirror? A. The mirror's surface is angled 5 degrees upward where the laser strikes it. B. The mirror's surface is angled 5 degrees downward where the laser strikes it. C. The mirror's surface is angled 10 degrees upward where the laser strikes it. D. The mirror's surface is angled 10 degrees downward where the laser strikes it. If the measure of angle A=55 degrees, b=12, and c = 7 then find the measure of angle B. PLEASE HURRY 100 POINTS!!!!What are the powers of the lieutenant governor of Louisiana? Check all that apply. appoint officials and workersensure the governor can fulfill the duties of the office participate on boards and committees serve in place of the governor when needed appoint cabinet members A stock has a beta of 1.5 and an expected return of 16.35%. What is the risk-free rate if the market rate of return is 12.5% What is the answer answer to number one will mark brainlist Kelly collected $15, $15, $25, and $29 in the last 4 donations for the class fundraiser. The mean of the donations is _____? A dominant allele masks/hides the effect of a recessive allele. After You ReadMini Glossaryatomic number: the number of protons in an atom ofan elementmass number: the sum of the number of protons andneutrons in an atomaverage atomic mass: the average mass of the element'sisotopes, weighted according to the abundance of each isotopenuclear decay: a process that occurs when an unstable atomicnucleus changes into another more stable nucleus byemitting radiationion: an atom that is no longer neutral because it has gained orlost electronsradioactive: spontaneously emits radiationisotope: an atom of the same element that has a differentnumber of neutrons1. Review the terms and their definitions in the Mini Glossary. Write a sentence thatexplains how to determine the number of neutrons in an isotope that has 6 protons anda mass number of 13.