Hello there.

I'm new in python thats why i hope for one quick explanation.

I'm making this program just for fun tho i dunno how to really use raw_input in loop.

from random import *
ime_f = raw_input("Vnesi ime fanta: ");
priimek_f = raw_input("Vnesi priimek fanta: ");
ime_z = raw_input("Vnesi ime deklice: ");
priimek_z = raw_input("Vnesi priimek deklice: ");
x = randint(0, 70);

if ime_f == "Lojze" & priimek_f == "Slak" & ime_z == "Mihela" & priimek_z == "Cas":
    print "Ujemanje je 100%";
else:
     print x;

the thing is that i dont know the syntax so that the 8th line would work. What should i do so that if i enter the right words that the condition would be fulfilled?

Quick work out.

have fun

from random import *


while 1:
  ime_f = raw_input("Vnesi ime fanta: ");
  priimek_f = raw_input("Vnesi priimek fanta: ");
  ime_z = raw_input("Vnesi ime deklice: ");
  priimek_z = raw_input("Vnesi priimek deklice: ");
  x = randint(0, 70);
  if ime_f == "Lojze" and priimek_f == "Slak" and ime_z == "Mihela" and priimek_z == "Cas":
    print "Ujemanje je 100%";
    break
  else:
     print x;

thank you very much. I cannot belive i didn't see this one. Guess i have been out of programming for to long

Here's a basic example of my input loops:

for line in iter(lambda: input("Enter something (nothing to quit): "), ""):
    print (len(line))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.