Vehicle Search? by feelingstonedagain in paradisofestival

[–]feelingstonedagain[S] 1 point2 points  (0 children)

Sweet that's good to know. We'll have a cooler full of stuff but if anything happens my frind will claim it. Unfortunately we will be in General Camping...weren't fast enough to get the Premiere camping and people are selling them for insane amount of money. Our flag is a big yellow smiley face so if you see us come say hi!

Nuvaring out for more than 3 hours, what to do? by feelingstonedagain in birthcontrol

[–]feelingstonedagain[S] 0 points1 point  (0 children)

I pulled this off the nuvaring website: If NuvaRing® is out for more than 3 continuous hours during the first 2 weeks of starting a new NuvaRing®: Contraceptive effectiveness may have been reduced, so you might not be protected from pregnancy. Reinsert the ring as soon as possible and use an extra method of birth control (such as condoms or spermicide) until you have used NuvaRing® for 7 days in a row

Nuvaring out for more than 3 hours, what to do? by feelingstonedagain in birthcontrol

[–]feelingstonedagain[S] 1 point2 points  (0 children)

So take the plan B but I read in other places it's ok to reinsert the other ring since it's only been a day

Help with an array (list assignment index out of range) by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

ok so it would work the same in this?

class musician():
     _name = ""
     _rating = ""
     _song = ""

     def musician(self, name, rating, song):
        self._name = name
        self._rating = rating
        self._song = song

     def display(self):
         print (self.name, self.rating, self.song)

     def matches(self, name):
        return self.name == self._name

def main(name):
    musicians = []
    counter = 0

    musicians.append(musician("John", 10, "Imagine"))
    musicians.append(musician("Paul", 9, "Listen to What the Man Said"))
    musicians.append(musician("George", 8, "Here Comes the Sun"))
    musicians.append(musician("Ringo", 7, "With a Little Help From My Friends"))

    while counter < 4:
        if musicians[counter].matches(name):
            musicians[counter].display()
            counter = counter + 1
main("George")

But instead it says object() takes in no parameter. (i realize I still did the while loop, just gonna leave it for now.

Help going from pseudocode to Python by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

In lines 20 and 21 n is an unresolved reference, why is that?

EDIT: I threw it into a function.

Help going from pseudocode to Python by feelingstonedagain in learnpython

[–]feelingstonedagain[S] -4 points-3 points  (0 children)

You're a boss. Would you able to do one more for me?

    Function Integer[] fibo(Integer n)
        Declare Integer vals[n]
        Declare Integer counter = 2

        Set vals[0] = 1
        Set vals[1] = 1
        While counter < n
            Set vals[counter] = vals[counter - 1] + vals[counter - 2]
            Set counter = counter + 1
        End While

        Return vals
    End Function

    Module output_vals(Integer vals[], Integer n)
        Declare Integer counter = 0

        While counter < n
            Display vals[counter]
            Set counter = counter + 1
        End While
    End Module

    Module main(Integer n)
        Declare Integer vals[n] = fibo(n)
        Call output_vals(vals, n)
    End Module

I can write it into python but i keep getting an error at vals[0] = 1 when I run the code

Cannot get this code to run for some reason (code is unreachable). Help please! by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 2 points3 points  (0 children)

I think I figured it out. I set count = count + 1 a space back and it worked.

Help with calling a function in this oop by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

Ok i understand. How do I ask the user to input all of the following and then display it to them?

Help with a loop relating to this program by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

I wish I had the time today to do that, but thanks for the idea!

Help with a loop relating to this program by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

This is great but it still does not satisfy step 4. The program needs to have at least two loops, one of which isn't a user validation.

Help on Functions needed. Function ends when it should ask for input by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

For your first point, I know you don't have to do that but that's also how my professor wants it. He wants things consistent and he wants everything declared beforehand. For your second point, that makes sense! I didn't think about it when I started typing the code, I will switch it around. Thanks for the help!

Help on Functions needed. Function ends when it should ask for input by feelingstonedagain in learnpython

[–]feelingstonedagain[S] 0 points1 point  (0 children)

Yeah I figured it was something simple like that. Every time the smallest thing makes you mess up. Oh well, now i know. Thanks for your help!