Python Forum
Beginner Help request: Calculator
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner Help request: Calculator
#6
(Sep-20-2017, 12:40 AM)JinLee Wrote: Python 3 resolved it! Funny how there are differences with syntax between the two versions.

In python2, input() will call eval() on whatever you type in, which is incredibly bad. In python3, input() was removed completely, and replaced with what used to be raw_input(), since that's what 99.9% of people want to be using anyway.

That fixed it for you, because when you type a number, it'd get passed to eval() in python2, and would then be a number, instead of a string. In python3, anything from input() is always a string.
Reply


Messages In This Thread
Beginner Help request: Calculator - by JinLee - Sep-19-2017, 06:55 AM
RE: Beginner Help request: Calculator - by ocpaul20 - Sep-19-2017, 07:14 AM
RE: Beginner Help request: Calculator - by Sagar - Sep-19-2017, 07:41 AM
RE: Beginner Help request: Calculator - by buran - Sep-19-2017, 08:02 AM
RE: Beginner Help request: Calculator - by JinLee - Sep-20-2017, 12:40 AM
RE: Beginner Help request: Calculator - by nilamo - Sep-20-2017, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how can I correct the Bad Request error on my curl request tomtom 8 5,091 Oct-03-2021, 06:32 AM
Last Post: tomtom
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,948 Jun-18-2020, 08:07 AM
Last Post: buran
  BEGINNER: My calculator doesnt work iskov 5 3,228 Oct-09-2019, 07:45 AM
Last Post: buran
  Beginner. Calculator problem ¯\_(ツ)_/¯ stykus1992 0 2,361 Feb-15-2018, 11:01 AM
Last Post: stykus1992

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020