Recent questions tagged python

Description : Where can I find a cross between a resume and a character sheet?

Last Answer : A curriculum vitae is what you want.

Description : What is the take away from this python, and ventilation system related story?

Last Answer : answer:I am suspicious of the story until the autopsy results are available. Snakes don't tend to catch and release - I'm surprised it didn't ingest the child. Snakes ... ineffective. Regulations allow the control and monitoring of populations, and hopefully fewer underground/illegal ownership.

Description : What's more powerful, JavaScript or Python?

Last Answer : Python is server side. You use python to output HTML/CSS/Javascript that the browser interprets. Your browser doesn’t know what Python is.

Description : More Rails Devs/jobs than Django?

Last Answer : Rails was opensourced about a year before Django and it had good marketing. There were all kinds of videos of “create a blog in under X minutes,” DHH was preaching the gospel of Ruby, etc. Ruby vs. Python, Rails vs. Django comes down to your own programming style and preferences.

Description : Django or Rails?

Last Answer : In the grand scheme of things, both Django and Rails are pretty equivalent—My suggestion is let the language you want to use determine things (and give Ruby a try if you haven’t played with it much but you have with Python).

Description : What are the differences between Perl, PHP, and Python?

Last Answer : Um, i unfortunately cannot answer this question, but I have to ask: why the NSFW tag?

Description : What are the advantages and disadvantages of various web site development and hosting software?

Last Answer : On my personal computer I use xampp: apache, php, mysql On servers I use: apache, php, mysql. I would recommend mysql over mssql. As for your question about what works better with each other I would assume they all work together fine, but I could be wrong, since I don’t use java or python.

Description : How do I get an RSS feed for Twitter without a user/password required?

Last Answer : Actually, that looks like javascript and this might help if you haven’t figured it out already. Also this

Description : Should I learn PyObjC or just dive right into Objective C?

Last Answer : Nerd. :)

Description : Looking for a unit-testing framework that can work with AppEngine projects?

Last Answer : The folks at Google wrote their examples in JUnit: http://code.google.com/appengine/docs/java/tools/localunittesting.html. As a big fan of the xUnit frameworks, I’d consider that a stroke of good luck.

Description : What is the best platform for buildinga socail site; Python, ROR, or ASP.Net?

Last Answer : I would probably go with Django if you are down with Python. I hate RoR with a passion. Have you looked at any of the PHP based MVC frameworks? I’m fond of CakePHP myself. And I know lots of people like to hate on PHP, but it is fast and it works.

Description : So why are there so few web hosting services that offer Python support?

Last Answer : Virtual hosting and colocated hosting are so cheap now that shared-server web hosting services have to cut back on services. So shared-server web hosts focus on the features that the cheapskates of the ... -rate shared-server web hosts, but you'll actually be able to install the software you need.

Description : Is the Python Imaging Library not available on PyPI, or am I missing something?

Last Answer : Hm, forcing it to find-links seems to be working: easy_install -f http://www.pythonware.com/products/pil/ Imaging Got a heap of warnings along the way though. I’ll see how it turns out.

Description : What is the easiest and fastest way/language/tool I can use to build high quality animated web content and web apps.?

Last Answer : You can do a lot with jQuery. For example.

Description : How has the experience of developing Ask-public.com been with regards to the software used?

Last Answer : At the top of ask-public’s main page, there is a contact button, ask the two creators of this site how they did it & what problems they ran into. Since they were the ones to create it, none of us made ask-public.

Description : Is Django Worth It?

Last Answer : answer:I'm a C++ guy, and I decided that I had to learn to program for the web. I spent over a year thinking about what direction to get, as I wanted to learn a single framework, but be really good ... quite a tough time. I've been working in Django for 7 months, and I've not regreted it even ONCE.

Description : How to write a Python program (i)to calculate area of a circle and (ii)to find if a given number is even or odd. -Python

Last Answer : (i) # 1.Circle pi = 3.14 r = int(input("Please enter the Radius of the circle:")) area = pi*r*r print("Area of the circle is" + str(area) + "sq ms") (ii) # 2. Odd Number & Even Number Number = int( ... Number % 2 == 0): print("This is an Even Number") else: print("It's an Odd Number")

Description : Write a Python statement for assigning a string have a good day to a variable good -Python

Last Answer : good = "have a good day" Here good is the variable name and have a good day is a value in string (text)

Description : List out the different operators used in Python. What is the difference between operant’s and operators explain with example. -Python

Last Answer : Python divides the operators in the following groups: Arithmetic operators Assignment operators Comparison operators Logical operators Identity operators Membership operators Bitwise operators For students of class 9th : Arithmetic operators Assignment ... the right x >= y = x >>= 5 x = x >> 5

Description : How to write python statement for assigning a value 55.5 to a variable maths -Python

Last Answer : variable name = "maths" value = "55.5" maths = 55.5

Description : What is a program ? -Python

Last Answer : Program is a set of instructions to perform a specific task using any programming language.

Description : how to run a python program in visual studio ? -Python

Last Answer : By creating a file It's simple to run anyfilename.py with Python. Just click the Run Python File in Terminal play button in the top-right side of the editor. Your program will start executing. ... Run Selection/Line in Python Terminal. This command is convenient for testing just a part of a file

Description : How can we execute Python Programs in Windows 10? -Python

Last Answer : If you have made an python program or u want to make it and execute it the you can do it by various methods : 1) With an IDE : => What is IDE IDE, or Integrated Development Environment, is a software ... into the python shell ... you can start typing your code .... try to type print("Hello World!")

Description : What is Python?

Last Answer : Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax ... an ideal language for scripting and rapid application development in many areas on most platforms.

Description : What will be the output of the following Python code? >>> a={4,5,6}>>> b={2,8,6}>>> a+b a) {4,5,6,2,8} b) {4,5,6,2,8,6} c) Error as unsupported operand type for sets d) Error as the duplicate item 6 is present in both sets

Last Answer : Answer: c Explanation: Execute in python shell to verify.

Description : If a={5,6,7}, what happens when a.add(5) is executed? a) a={5,5,6,7} b) a={5,6,7} c) Error as there is no add function for set data type d) Error as 5 already exists in the set

Last Answer : Answer: b Explanation: There exists add method for set data type. However 5 isn’t added again as set consists of only non-duplicate elements and 5 already exists in the set. Execute in python shell to verify.

Description : If a={5,6,7,8}, which of the following statements is false? a) print(len(a)) b) print(min(a)) c) a.remove(5) d) a[2]=45

Last Answer : Answer: d Explanation: The members of a set can be accessed by their index values since the elements of the set are unordered.

Description : What will be the output of the following Python code? >>> a={5,4}>>> b={1,2,4,5}>>> a

Last Answer : Answer: b Explanation: a

Description : Which of the following statements is used to create an empty set? a) { } b) set() c) [ ] d) ( )

Last Answer : Answer: b Explanation: { } creates a dictionary not a set. Only set() creates an empty set.

Description : What will be the output of the following Python code? nums = set([1,1,2,3,3,3,4,4])print(len(nums)) a) 7 b) Error, invalid syntax for formation of set c) 4 d) 8

Last Answer : Answer: c Explanation: A set doesn’t have duplicate items.

Description : Which of the following is not the correct syntax for creating a set? a) set([[1,2],[3,4]]) b) set([1,2,2,3,4]) c) set((1,2,3,4)) d) {1,2,3,4}

Last Answer : Answer: a Explanation: The argument given for the set must be an iterable.

Description : Which of these about a set is not true? a) Mutable data type b) Allows duplicate values c) Data type with unordered values d) Immutable data type

Last Answer : Answer: d Explanation: A set is a mutable data type with non-duplicate, unordered values, providing the usual mathematical set operations.

Description : What will be the output of the following Python code? >>>t = (1, 2) >>>2 * t a) (1, 2, 1, 2) b) [1, 2, 1, 2] c) (1, 1, 2, 2) d) [1, 1, 2, 2]

Last Answer : Answer: a Explanation: * operator concatenates tuple.

Description : What will be the output of the following Python code? d = {"john":40, "peter":45} d["john"] a) 40 b) 45 c) “john” d) “peter”

Last Answer : Answer: a Explanation: Execute in the shell to verify.

Description : What will be the output of the following Python code? >>>t = (1, 2, 4, 3, 8, 9) >>>[t[i] for i in range(0, len(t), 2)] a) [2, 3, 9] b) [1, 2, 4, 3, 8, 9] c) [1, 4, 8] d) (1, 4, 8)

Last Answer : Answer: c Explanation: Execute in the shell to verify.

Description : What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:-1] a) (1, 2) b) (1, 2, 4) c) (2, 4) d) (2, 4, 3)

Last Answer : Answer will be (2,)

Description : What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:3] a) (1, 2) b) (1, 2, 4) c) (2, 4) d) (2, 4, 3)

Last Answer : Answer: c Explanation: Slicing in tuples takes place just as it does in strings.

Description : Suppose t = (1, 2, 4, 3), which of the following is incorrect? a) print(t[3]) b) t[3] = 45 c) print(max(t)) d) print(len(t))

Last Answer : d) print(len(t)) is incorrect. In python, len(t) is a built-in function that returns the number of items in the tuple t. Since t contains 4 items, len(t) would correctly return 4. a) print(t[ ... of tuple. c) print(max(t)) is correct, it will return the maximum element of tuple which is 4.

Description : Which of the following is a Python tuple? a) [1, 2, 3] b) (1, 2, 3) c) {1, 2, 3} d) {}

Last Answer : Answer: b Explanation: Tuples are represented with round brackets.

Description : What will be the output of the following Python code snippet? d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} d1 > d2 a) True b) False c) Error d) None

Last Answer : Answer: c Explanation: Arithmetic > operator cannot be used with dictionaries.

Description : What will be the output of the following Python code snippet? d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} d1 == d2 a) True b) False c) None d) Error

Last Answer : Answer: b Explanation: If d2 was initialized as d2 = d1 the answer would be true.

Description : What will be the output of the following Python code snippet? d = {"john":40, "peter":45} "john" in d a) True b) False c) None d) Error

Last Answer : Answer: a Explanation: In can be used to check if the key is int dictionary.

Description : What will be the output of the following Python code snippet? d = {"john":40, "peter":45} a) “john”, 40, 45, and “peter” b) “john” and “peter” c) 40 and 45 d) d = (40:”john”, 45:”peter”)

Last Answer : Answer: b Explanation: Dictionaries appear in the form of keys and values.

Description : Which of the following statements create a dictionary? a) d = {} b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) All of the mentioned

Last Answer : A

Description : What does 3 ^ 4 evaluate to? a) 81 b) 12 c) 0.75 d) 7

Last Answer : Answer: d Explanation: ^ is the Binary XOR operator.

Description : What is the result of round(0.5) – round(-0.5)? a) 1.0 b) 2.0 c) 0.0 d) None of the mentioned

Last Answer : Answer: b Explanation: Python rounds off numbers away from 0 when the number to be rounded off is exactly halfway through. round(0.5) is 1 and round(-0.5) is -1.

Description : Which of the following is incorrect? a) float(‘inf’) b) float(‘nan’) c) float(’56’+’78’) d) float(’12+34′)

Last Answer : Answer: d Explanation: ‘+’ cannot be converted to a float.

Description : What is the result of cmp(3, 1)? a) 1 b) 0 c) True d) False

Last Answer : Answer: a Explanation: cmp(x, y) returns 1 if x > y, 0 if x == y and -1 if x < y

Description : Which of the following is incorrect? a) x = 0b101 b) x = 0x4f5 c) x = 19023 d) x = 03964

Last Answer : Answer: d Explanation: Numbers starting with a 0 are octal numbers but 9 isn’t allowed in octal numbers.

Description : What does ~~~~~~5 evaluate to? a) +5 b) -11 c) +11 d) -5

Last Answer : Answer: a Explanation: ~x is equivalent to -(x+1).