Python Forum
What dose these commands mean?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What dose these commands mean?
#1
What dose these commands mean? Huh Variable, Import random, Def(Getwords, Return, Checklists)While, Print, Input, For n in range, List. From a confusinng Norwegian teenage Tongue Btw, here is the full code if you need the context.

import random

def getWords(list1):
    list=["Nils", "Gulvmatte", "Potet","Teddy", "Iskrem","Python","Kodeklubben","Hus","Fjell","Nisse","Bjørn","Elefant"]
    pos = random.randint(0, len(list)-1)
    list1.append(list[pos])
    return list1

def checkLists(list1, list2):
    return list1==list2
        
list1=[]
list2=[]
num=0
while(checkLists(list1,list2)):
    list1=getWords(list1)
    print(list1)
    input("Klikk enter når du er klar til å huske")
    for n in range(100):
        print()
    ans=input("Skriv inn ordene i riktig rekkefølge, skill dem med bindestrek -")
    list2=ans.split("-")
    num+=1
print("Bra, du klarte å huske "+str(num-1)+" ord på rad")
Reply


Messages In This Thread
What dose these commands mean? - by Mads - Jan-03-2018, 11:51 AM
RE: What dose these commands mean? - by j.crater - Jan-03-2018, 12:17 PM
RE: What dose these commands mean? - by squenson - Jan-03-2018, 12:22 PM
RE: What dose these commands mean? - by Mads - Jan-07-2018, 09:38 PM
RE: What dose these commands mean? - by Mads - Jan-10-2018, 11:44 AM
RE: What dose these commands mean? - by squenson - Jan-10-2018, 12:18 PM
RE: What dose these commands mean? - by Mads - Jan-10-2018, 12:42 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020