0

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?

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by seanbp
0

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;
0

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

0

Here's a basic example of my input loops:

for line in iter(lambda: input("Enter something (nothing to quit): "), ""):
    print (len(line))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.