Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def calc(k):

print ("\nScientific Calculator\nEg: pi * sin(90) - sqrt(81)")

k = input("\nWhat is ")
k = raw_input("\nWhat is ") # Using input() function is causing NameError. Changing it to raw_input() fixes this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayush1999 python3 input will give you a string no matter what you input.py2 is different so,raw_input =>string,and input may result in a number if you input like"1+2".if wrong,thanks for telling me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python 2, raw_input will always return a string, however input will treat it as an expression.
In Python 3, input returns a string. Maybe this helps!


k = k.replace(' ', '')
k = k.replace('^', '**')
Expand Down