Study group Slovenia

Sem čisti začetnik glede programiranja (razen nekaj osnov MATLAB-a iz faksa).
Zato sem se lotil prvo teorije (prva dva poglavja):
How to Think Like a Computer Scientist

Se pa v kratkem lotim tudi Codeacademy. Predvidevam da bom imel dosti težav, zato bom hvaležen za vsako pomoč in nasvet. :smile:
Mislim, da bom prvo sprintal listo vseh teh novih izrazov in njihov pomen.

Rok, mene je pogled na ves tisti tekst demoraliziral :wink: Zato sem šla raje na Codecademy. Priporočam. Geš korak za korakom in takoj povadiš :wink:

1 Like

String & Console:

On line 13, assign the variable fifth_letter equal to the fifth letter of the string “MONTY”.

Jaz pa butec gledam gor v PYTHON in zakaj ne dela… :wink:

Čisto iz ferbca: bo delal kdo tetris?

Jaz grem najprej skozi Phytona v Codecademyji. Pa me že tu ene stvari hecajo. Kaj šele tetris :wink:

Planiram naredit/se naučit čim več, tudi tetris seveda. :slight_smile:

Ampak tale p2pu.org - tolk spema pa še nikol! Kar pošiljajo mi za vsak božji topic v CELEM SAJTU.

Saj to se da vse pr nastavitvah nastavit. Mislim, da je bilo celo treba označit pogostost prejemanja obvestil pri ustvarjanju profila. :slight_smile:

Zgoraj desno kliknete svoj profil (črka N pri vas), izberete -> Preferences, scroll navzdol dokler ne vidite opcije Email.
Tam je možno obkljukati kdaj in za katere stvari dobite email. Upam da so bila moja navodila v pomoč.

A dela kdo Codecademy? Sem se ustavila na A Day at the Supermarket 11/13 in ne morem naprej.

Ko kodo sprožim v Sumlime text 2, ne javi nobene napake, tu mi pa jabolke nagajajo. Pa sem eno že vmes pojedla :wink:
In ka Q&A ne najdem rešitve :frowning:

Se mi zdi, da me academija zafrkava. Ko grem naprej, pokaže isto kodo kot pravo :frowning: Nekaj ni v redu.

Spet jaz :frowning:

Codecademy mi nagaja, ko “želim postati učitelje” pri 8/9

Javi mi napako

pa grem potem naprej in dodam šenalogo 9/9 in pravi, da je vse OK.

Kaj bi bilo narobe? Sem gledala Q&A, kjer eden pravi, da return average(results) umaknem iz zanke, vendar pri meni to ne deluje. Kakšna ideja?
Hvala.

Jaz sem se lotil zadeve v tempu, ki ga je predlagal ‘my mechanical friend MOOC-E’ in sem predelal prve dve temi/poglavja (python syntax, strings and console output).

Skratka, niti približno nisem tako daleč kot ste vi. :slight_smile: Bom probal pomagat ko pridem do tja, če bo še aktualno.

total += prices(item)

… should be …

total += prices[item]

Within the for loop, the variable, item, holds the key you need to access the prices dictionary, and that key needs to be surrounded by square brackets [ ], not parentheses.

Thanks. :sunglasses:

@vika in the for loop you have a statement:

for student in students:
    return get_average(student)
    result.append(get_average(student))

but because you are using return before you append the average to the result variable, you are always just getting the average from the first item in the students list.
You start the function, but then you tell it to stop and return something in the first turn of the loop.
Delete the:

 return get_average(student)

and try again.

Good job!

@Mooc_e, thanks, but it didn’t work. I found a solution for 8/9 (Student Becomes the Teacher) :sunglasses:

students = [lloyd, alice, tyler]

def get_class_average(students):
    results = []    
    for student in students:
        results.append(get_average(student))
    return float(sum(results)/len(results))
1 Like

Is anyone in Study group Slovenia working on Exercise 1.7 – Rock, Paper, Scissors from MIT 6.189 Homework 1? Among the MMOOC in general, we have come up with a variety of approaches, and it would be interesting to see additional examples of code.

Here’s mine:

player_1 = raw_input(“Player 1, choose your weapon.”)
player_2 = raw_input(“Player 2, choose your weapon.”)
if (player_1 == ‘rock’ and player_2 == ‘rock’):
print "It’s a tie!"
elif (player_1 == ‘rock’ and player_2 == ‘paper’):
print "Player 2 wins!"
elif (player_1 == ‘rock’ and player_2 == ‘scissors’):
print "Player 1 wins!"
elif (player_1 == ‘paper’ and player_2 == ‘rock’):
print "Player 1 wins!"
elif (player_1 == ‘paper’ and player_2 == ‘paper’):
print "It’s a tie!"
elif (player_1 == ‘paper’ and player_2 == ‘scissors’):
print "Player 2 wins!"
elif (player_1 == ‘scissors’ and player_2 == ‘rock’):
print "Player 2 wins!"
elif (player_1 == ‘scissors’ and player_2 == ‘paper’):
print "Player 1 wins!"
elif (player_1 == ‘scissors’ and player_2 == ‘scissors’):
print "It’s a tie!"
else:
print “This is not a valid input.”

1 Like

vijolica9:

Thanks for posting your code.

I hope your study group in Slovenia is enjoying the course.

Something that @TutorialDoctor posted that helped me shorten my solution to this one was to check for a tie first, like this …

if p1==p2:
    print "Tie"

By doing something similar, I was able eliminate several lines. In the case of your code, if you do this near the beginning …

if (player_1 == player_2):
    print "It's a tie!"

You could eliminate lines such as …

elif (player_1 == 'paper' and player_2 == 'paper'):
    print "It's a tie!"

The same goes for 'rock' and 'scissors'.

@dirk described how we can format our posted code in this post, so that indentation gets displayed.