Lecture notes 03/10/22



Import maya.cmds

Hold right click on highlighted variable, gives options and command documentation (shows flags, values, all that good stuff)

Remember to name variables something unique and memorable. Can’t start variables with numbers

 

Remember W3 schools, very good source of Python info

 

So floats and integers are the same as in Java, with the exception that Python seems to allow a conversion from floats to integers. That would have been fucking useful last year. Complex numbers are a new thing, and they seem to herald the approach of algebra. I am afraid.

But for memories sake, it’s the usual:

Int = whole numbers, cannot have decimals. More easily optimised, but with modern computers it’s less of an issue

Float = floating point value, so allows decimals. Most useful one, at least in Java, but can be complicated

Complex = This is a new one. Seems to allow algebra, with the use of j as an imaginary number. I did foundation in maths, so this is beyond me at the moment but it’ll probably come up in the future. For now, I’m sticking with float values and integers.

 

Coding for today import random

nameList = ["Panda", "Floor", "Sof", "Aragorn", "James", "Tristan", "Ash", "Denys", "Joanne", "Frost"]

professionList = ["Plumber", "Surgeon", "Unemployed", "Student", "War Criminal", "Lecturer", "Emperor of the Known Universe", "Coder", "Dungeon Master", "Chef", "Lawyer"]

randomAge                                        = random.randrange(4,99)

randomName                                    = random.choice(nameList)

randomProfession          = random.choice(professionList)

 

 

n = "Name:"

a = "Age:"

p = "Profession:"

 

print      (a,randomAge)

print      (n,randomName)

print      (p,randomProfession)

print      ()

print      ()

print      (type(n))

print      (type(a))

print      (type(p))

print      ()

print      (type(randomAge))

print      (type(randomName))

print      (type(randomProfession))

print      (type(nameList))

print      (type(professionList))

 

 

Leave a comment

Log in with itch.io to leave a comment.