[ spredic @ 25.01.2013. 10:35 ] @
Pozdrav, ja sam pocetnik i gledam video lekcije, u sedmoj lekciji su IF statement i bolean logika, zeza me pokretanje modula, fajla, kaze syntax error, i selektuje mi znak za procenat % koji se nalazi ispred fmenu.get, evo ga kod pa mi kazite sta mu fali sa ovim %:

Code:

fmenu = {'spam':1.50, 'ham':1.99, 'eggs':0.99}
corder = input("What will you have today--spam, ham or eggs? ")

if corder == 'spam':
    print("For the spam, that will be", "$", "%.2f", % fmenu.get('spam'), ", please.")
    
elif corder == 'ham':
    print("Your total for the ham is", "$", "%.2f" % fmenu.get('ham')),
    
else:
    print("Eggs by default! Your total is", "$", "%.2f" % fmenu.get('eggs'))
[ HeYoo @ 25.01.2013. 16:50 ] @
Code (python):


#mislim da je u pitanju zarez pre %:

    print("For the spam, that will be", "$", "%.2f" % fmenu.get('spam'), ", please.")

#ali zasto ne bi uradio ovako:

    print("For the spam, that will be $ %.2f , please." % fmenu.get('spam'))

 
[ spredic @ 27.01.2013. 12:47 ] @
e hvala, zarez stvara krizu :)
probao sam i tvoj primer i moze i tako, videcu vremenom sta mi je lakse. tek sam krenuo da ucim pa pratim cbt nuggets lekcije.