omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. PythonKing

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 5
    • Best 0
    • Controversial 0
    • Groups 0

    PythonKing

    @PythonKing

    0
    Reputation
    776
    Profile views
    5
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    PythonKing Unfollow Follow

    Latest posts made by PythonKing

    • RE: newbie problem
      #This is my Automatic Report Writer Script
      #It uses lists, choices and If, Elif and Else statements and my own functions!
      #coding utf-8
      
      #-----Import libaries-----#
      
      from random import choice
      
      #-----Variables------#
      
      pupil_details = [["Tom","b","good"],["Pierre","b","bad"],["Hilary","g","ok"],["Victoria","g","bad",],["Jimmy","b","good"],["James","b","ok"],["Alice","g","good"],["Lilly","g","bad"]]
      
      pupil_gender = ["He","She"]
      
      pupil_behaviour_good = [" should be rewarded."," adds a whole new dimension to lessons."," knows more than the teacher."," makes me want to cry."," needs to be admired."]
      
      pupil_behaviour_ok = [" does a good job."," should be pleased."," has a good understanding of the topics."," shows the poor performers what they could become."," should be given a Freddo."]
      
      pupil_behaviour_bad = [" should be disciplined."," needs to care about their future."," needs extra tutition."," should retake tests."," needs to aim for higher grades."]
      
      
      #------Functions-----#
      
      def make_report():                               #This function makes reports.
      	for i in pupil_details:                        #For each list in the pupil_details...
      		print ("This is the report for " +i[0])      #Print the title and the pupil's name.
      
      		if i[2] == "good":                           #If the pupil was behaving good...
      			print(i[0] + choice(pupil_behaviour_good)) #Print pupil's name and a random element from the 
          	                                           #pupil_behaviour_good list.
          	
      		elif i[2] == "ok":                           #If the pupil was behaving ok...
      			print(i[0] + choice(pupil_behaviour_ok))   #Print pupil's name and a random element from the
          	                                           #pupil_behaviour_good list
          	
      		else:                                        #There is only one other option...
      			print(i[0] + choice(pupil_behaviour_bad))  #print pupil's name and a random element from the
          	                                           #pupil_behaviour_bad list.
          	
      		print("\n")                                  #Create a new line before the next report.
      
      #------Initialisation------#
      
      
      
      
      #------Main Program Code-----#
      make_report()
      
      posted in Pythonista
      PythonKing
      PythonKing
    • RE: newbie problem

      #This is my Automatic Report Writer Script
      #It uses lists, choices and If, Elif and Else statements and my own functions!
      #coding utf-8

      #-----Import libaries-----#

      from random import choice

      #-----Variables------#

      pupil_details = [["Tom","b","good"],["Pierre","b","bad"],["Hilary","g","ok"],["Victoria","g","bad",],["Jimmy","b","good"],["James","b","ok"],["Alice","g","good"],["Lilly","g","bad"]]

      pupil_gender = ["He","She"]

      pupil_behaviour_good = [" should be rewarded."," adds a whole new dimension to lessons."," knows more than the teacher."," makes me want to cry."," needs to be admired."]

      pupil_behaviour_ok = [" does a good job."," should be pleased."," has a good understanding of the topics."," shows the poor performers what they could become."," should be given a Freddo."]

      pupil_behaviour_bad = [" should be disciplined."," needs to care about their future."," needs extra tutition."," should retake tests."," needs to aim for higher grades."]

      #------Functions-----#

      def make_report(): #This function makes reports.
      for i in pupil_details: #For each list in the pupil_details...
      print ("This is the report for " +i[0]) #Print the title and the pupil's name.

      if i[2] == "good": #If the pupil was behaving good...
      print(i[0] + choice(pupil_behaviour_good)) #Print pupil's name and a random element from the
      #pupil_behaviour_good list.

      elif i[2] == "ok": #If the pupil was behaving ok...
      print(i[0] + choice(pupil_behaviour_ok)) #Print pupil's name and a random element from the
      #pupil_behaviour_good list

      else: #There is only one other option...
      print(i[0] + choice(pupil_behaviour_bad)) #print pupil's name and a random element from the
      #pupil_behaviour_bad list.

      print("\n") #Create a new line before the next report.

      #------Initialisation------#

      #------Main Program Code-----#
      make_report()

      posted in Pythonista
      PythonKing
      PythonKing
    • RE: newbie problem

      Sorry, me again. I'm working my way through some projects my teacher has set and even though I'm copying what they have written exactly, it still goes wrong. In the following code, in the the first function (make report) when I try to run it, an error message comes up on if telling me i is not defined. How do I correct this. Thank you.

      pupil_details = [["Tom","b","good"],["Pierre","b","bad"],["Hilary","g","ok"],["Victoria","g","bad",],["Jimmy","b","good"],["James","b","ok"],["Alice","g","good"],["Lilly","g","bad"]]

      pupil_gender = ["He","She"]

      pupil_behaviour_good = [" should be rewarded."," adds a whole new dimension to lessons."," knows more than the teacher."," makes me want to cry."," needs to be admired."]

      pupil_behaviour_ok = [" does a good job."," should be pleased."," has a good understanding of the topics."," shows the poor performers what they could become."," should be given a Freddo."]

      pupil_behaviour_bad = [" should be disciplined."," needs to care about their future."," needs extra tutition."," should retake tests."," needs to aim for higher grades."]

      #------Functions-----#

      def make_report(): #This function makes reports.
      for i in pupil_details: #For each list in the pupil_details...
      print ("This is the report for " +i[0]) #Print the title and the pupil's name.

      if i[2] == "good": #If the pupil was behaving good...
      print(i[0] + choice(pupil_behaviour_good)) #Print pupil's name and a random element from the
      #pupil_behaviour_good list.

      elif i[2] == "ok": #If the pupil was behaving ok...
      print(i[0] + choice(pupil_behaviour_ok)) #Print pupil's name and a random element from the
      #pupil_behaviour_good list

      else: #There is only one other option...
      print(i[0] + choice(pupil_behaviour_bad)) #print pupil's name and a random element from the
      #pupil_behaviour_bad list.

      print("\n") #Create a new line before the next report.

      posted in Pythonista
      PythonKing
      PythonKing
    • RE: newbie problem

      Thank you

      posted in Pythonista
      PythonKing
      PythonKing
    • RE: newbie problem

      I have another newbie problem
      if age < 13:
      print ("You're rather young. Is'nt it your bedtime.")

      elif age < 20:
      print ("You are a teenager.")

      elif age < 25:
      print ("Are you at university? I studied how to be a computer.")

      elif age < 200:
      print ("You are so old. When do you retire?")

      else:
      print ("I'm so sorry. I only understand numbers.")
      This code always runs else. Could you please explain why?
      Thank you.

      posted in Pythonista
      PythonKing
      PythonKing