Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic Doubt in code
#4
Here's another way in python3:

def square (n):
  print (n, "squared is ", int(n)**2)
  return

n = input("Enter a number: ")
square (n)
I may be wrong but raw_input was dropped in python3 to just input.
Reply


Messages In This Thread
Basic Doubt in code - by prateek3 - Aug-19-2017, 10:56 AM
RE: Basic Doubt in code - by TypesWithSpoons2 - Aug-19-2017, 11:09 AM
RE: Basic Doubt in code - by snippsat - Aug-19-2017, 11:22 AM
RE: Basic Doubt in code - by cygnus_X1 - Aug-19-2017, 11:36 AM
RE: Basic Doubt in code - by prateek3 - Aug-19-2017, 11:57 AM
RE: Basic Doubt in code - by sparkz_alot - Aug-19-2017, 12:14 PM
RE: Basic Doubt in code - by ichabod801 - Aug-19-2017, 01:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I can't for the life of me get this basic If statement code to work CandleType1a 8 2,493 May-21-2024, 03:58 PM
Last Post: CandleType1a
Question Doubt about conditionals in Python. Carmazum 6 3,313 Apr-01-2023, 12:01 AM
Last Post: Carmazum
  A simple python doubt mohamedrabeek 2 1,577 Mar-26-2023, 07:24 PM
Last Post: deanhystad
  doubt about python tkinter and sqlite3 LONDER 2 2,974 Aug-14-2021, 08:48 AM
Last Post: ibreeden
  Python Doubt csrlima 5 3,934 Jan-23-2021, 12:23 AM
Last Post: csrlima
  List index out of range error when attempting to make a basic shift code djwilson0495 4 4,366 Aug-16-2020, 08:56 PM
Last Post: deanhystad
  Writing a basic shift code djwilson0495 2 3,030 Aug-16-2020, 01:52 PM
Last Post: djwilson0495
  Python Exercise Doubt azure 4 3,720 Apr-21-2020, 01:15 PM
Last Post: azure
  Doubt in Regex Lookaround fullstop 3 3,361 Feb-03-2020, 09:53 AM
Last Post: Gribouillis
  A doubt with 'in' and 'not in' operators with strings newbieAuggie2019 7 5,818 Oct-23-2019, 03:11 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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