working on a script which is pretty basic where groups of students are being assigned halls to stay in depending on what they are doing and also their age.  if someones course is medical they will be assined to res4.  medical would include dentistry and medicine. Seems to be a bit stuck on printing the hall assigned it should be res4. Thanks in advance.  medical=["dentistry", "medicine"]  course=input("enter course")  while course in medical     hall=="res4"      print("enter course", course, hall, )
2525
My  has failed me.  In Python, are the following two tests for equality equivalent?  n = 5 # Test one. if n == 5:     print 'Yay!'  # Test two. if n is 5:     print 'Yay!'   Does this hold true for objects where you would be comparing instances (a list say)?  Okay, so this kind of answers my question:  L = [] L.append(1) if L == [1]:     print 'Yay!' # Holds true, but...  if L is [1]:     print 'Yay!' # Doesn't.   So == tests value where is tests to see if they are the same object?
60852
Context: I'm studying for my discrete mathematics exam and I keep running into this question that I've failed to solve. The question is as follows.    Problem: The main form for normal induction over natural numbers $n$ takes the following form:   $P(1)$ is true, and for every $n, P(n-1)\to P(n).\qquad\qquad\qquad\text{[Sometimes written as $P(n)\to P(n+1)$]}$   If both 1 and 2 are true, then $P(n)$ is true for every $n$.  The question is to prove the correctness of the form above.    My work: My idea was to make a boolean statement and if it's a tautology in a true false table. That means the statement is always correct.  I've tried many times but I've failed.  Here is the original question in Hebrew:  n טענה כלשהי לגבי מםפר טבעי  $P(n)$ תהי   אם מתקימיים שני התנאים הבאים:  1- הטענה $P(0)$ נכונה  2- לכל n>0, $P(n)$ נכונות הטענה $P(n-1)$ גוררת את נכונות הטענה   אז $P(n)$ נכונה לכל מספר טבעי n  הוכיחו את נכונות משפט זה
113808
I'm writing 'cause I would like to know if there's an automatic way (like something to put in the preamble) to make the subscript behave as double subscript: for example if I write   something_a    it should behave as   something_{_a}
53456
What is the difference between:  some_list1 = [] some_list1.append("something")   and  some_list2 = [] some_list2 += ["something"]
58979
\documentclass[border=10pt]{standalone} \usepackage{pstricks-add,amsmath,amssymb} \begin{document} \begin{pspicture}[showgrid,arrowinset=0](0,-1)(4,2) \begin{psmatrix}[colsep=.5cm,rowsep=1.2cm] &amp; [name=A]\,\,\,\,\,\,\,\,\,\,\,\,$M_{0,4} \times \mathbb{P}^1 $\\ [name=B]$B$ &amp; [name=C]\,\,\,\,\,\,$M_{0,4}$ \end{psmatrix} \pcline[nodesep=.3]{-&gt;}(B)(C)       \nbput{$\kappa$} \pcline[nodesep=.3]{-&gt;}(A)(C)       \nbput[labelsep=.1]{$\pi$} \naput{\foreach \i in {0.1,0.25,0.4,0.55}{%     \pcline{-&gt;}(\i,-.4)(\i,.45)} \nbput[labelsep=.1]{$\sigma_i$}} \end{pspicture} \end{document}     After see all the answers, done :)   \documentclass[border=10pt]{standalone} \usepackage{pstricks-add,amsmath,amssymb} \begin{document} \begin{psmatrix}[colsep=.5cm,rowsep=1.2cm] &amp; [name=A]\qquad $M_{0,4} \times \mathbb{P}^1 $\\ [name=B]$B$ &amp; [name=C] \quad $M_{0,4}$ \end{psmatrix} \psset{arrowinset=0} \pcline[nodesep=.3]{-&gt;}(B)(C)       \nbput{$\kappa$} \pcline[nodesep=.3]{-&gt;}(A)(C)       \nbput[labelsep=.1]{$\pi$} \naput{\foreach \i in {0.1,0.25,0.4,0.55}{%     \pcline{-&gt;}(\i,-.4)(\i,.45)} \nbput[labelsep=.1]{$\sigma_i$}} \end{document}
1875
I am trying to use the  package.  I have the following counters defined (hopefully this is the right way to do it!)  \newtheorem{thm}{Theorem}[section] \newtheorem{lemma}[thm]{Lemma} \newtheorem{cor}[thm]{Corollary}   This works as I would like (i.e. Theorem 1.1, Corollary 1.2, Lemma 1.3, etc.)  My problem is \cref always returns Theorem 1.2, Theorem 1.3. I   Perhaps this is not right? (In my preamble)  \crefname{thm}{theorem}{theorem's} \crefname{lemma}{lemma}{lemma's}
18919
I am typing to get a sale amount (by input) to be multiplied by a defined sales tax (0.08) and then have it print the total amount (sales tax times sale amount).  I run into this error. Anyone know what could be wrong or have any suggestions?   salesAmount = raw_input (["Insert sale amount here \n"]) ['Insert sale amount here \n']20.99 &gt;&gt;&gt; salesTax = 0.08 &gt;&gt;&gt; totalAmount = salesAmount * salesTax  Traceback (most recent call last):   File "&lt;pyshell#57&gt;", line 1, in &lt;module&gt;     totalAmount = salesAmount * salesTax TypeError: can't multiply sequence by non-int of type 'float'
6017
So I'm making this summary of a course where I've only been getting information from one book. Sometimes I want to show what page from the book a statement is taken from but I can't figure out a clean way of doing it.  Basically I would like to have something (in function) similar to:  "Statement[Book p123]"  Do you have any suggestions?
116802
I have the following assignment:  Let $A_i= \left \{...,-2,-1,0,1,...,i \right\}$.   Find  a) $\displaystyle \bigcup_{i=1}^{n} A_i$   b) $\displaystyle \bigcap_{i=1}^{n} A_i$  I think the  first one is:  $\displaystyle \bigcup_{i=1}^{n} \left \{...,-2,-1,0,1,...,i \right\} = \left \{...,-2,-1,0,1,2...,n \right\}$  But what about the second one?
89450
I'm stuck with the basic counting problem.  Problem is the following:     Corrupt professor Z has a class of 50 students. He needs to give exactly 10 A's. However five students already have a special deal (they are professor Z's nephews and neices) and will get A's for sure. How many ways can the 10 A's be distributed?   My thought : 45 Choose 5, because we can ignore 5 people(nephews and nieces) who will get A's grade for sure.   I'm not sure my thought is correct or not. I'm appreciated any comment or explanation for this.
72908
I am trying to figure out this:  c = 1 def f(n):     print c + n  def g(n):     c = c + n  f(1) # =&gt; 2 g(1) # =&gt; UnboundLocalError: local variable 'c' referenced before assignment   Thanks!
3152
I have over 6000 records and half of them are formulas that are missing a variable so they result in #N/A on the spreadsheet, what i want to do is if the cell is #N/A then leave the cell blank, otherwise print a string like so  =IF(AR6347="#N/A","","string in here")   But this does not work with ="#N/A", is there a way to do this?
69342
I'm using this code to let the user enter in names while the program stores them in an array until they enter an empty string (they must press enter after each name):  people = [] info = 'a' # must fill variable with something, otherwise loop won't execute  while not info.empty?     info = gets.chomp     people += [Person.new(info)] if not info.empty? end   This code would look much nicer in a do ... while loop:  people = []  do     info = gets.chomp     people += [Person.new(info)] if not info.empty? while not info.empty?   In this code I don't have to assign info to some random string.  Unfortunately this type of loop doesn't seem to exist in Ruby. Can anybody suggest a better way of doing this?
43916
I have much more experience programming than I do with advanced mathematics, so perhaps this is just a comfort thing with me, but I often get frustrated when I try to follow mathematical notation. Specifically, I get frustrated trying to keep track of what each variable signifies.  As a programmer, this would be completely unacceptable no matter how many comments you added explaining it:  float A(float P, float r, float n, float t) {   return P * pow(1 + r / n, n * t); }   Yet a mathematician would have no problem with this:     $A = P\ \left(1+\dfrac{r}{n}\right)^{nt}$      where   $A$ = final amount   $P$ = principal amount (initial investment)   $r$ = annual nominal interest rate (as a decimal)   $n$ = number of times the interest is compounded per year   $t$ = number of years   So why don't I ever see the following?  $\text{final_amount} = \text{principal}\; \left(1+\dfrac{\text{interest_rate}}{\text{periods_per_yr}}\right)^{\text{periods_per_yr}\cdot\text{years}}$
111357
Hello I don't understand meaning of the symbol represented by a capital letter "I" in the formulas below. There is  to the paper with the formulas.    At the beginning I thought it mean "where c is not equal to the result of classifier T(m)", however in step (d) there is a multiplication symbol before it, so it probably mean that "I" should "return" a value.
54947
I recently got confused with the following choices while talking to a friend after class:  I sent her an email that I wouldn't come to the class. I sent her an email that I wouldn't be coming to the class. I sent her an email that I won't be coming to the class. I sent her an email that I won't come to the class.  Can we use the third and fourth sentence by any chance or is it completely ungrammatical? Some websites including the NYTimes have instances where both the past and future are mixed in their reports.
10915
I'm pretty new to coding and I want to get an opinion on my coding. I am learning Python and I made a really simple heads and tails guessing game.  import random import time import easygui import sys while True:     rand = random.choice(["Heads", "Tails"])     firstguess = raw_input("Guess Heads or Tails: ")     if firstguess == rand:         print "Wow you win"     else:         print "That is wrong you suck so bad lol."     time.sleep(2)     answer = easygui.buttonbox("Play again?", choices=["Yes","No"])     if answer == "Yes":         easygui.msgbox("Ok")     else:         break  easygui.msgbox("Ok, see you later!") sys.exit(0)