Code Let's call it first.pl 1~$ nl -ba first.pl 21 #!/usr/bin/env perl 32 43 use strict; # important pragma 54 use warnings; # important pragma 65 76 print "What is your username? "; # print out the question 87 my $username = <STDIN>; # ask for username 98 chomp($username); # remove “new line” 109 print …
Read MoreThese are the three core data types in python. Of course there are strings, int too. I'm listing this here as I often forget these: List Somewhat similar to tuple (see below) but changeable. Uses square brackets instead of parenthesis in tuple. 1>>> kirk = ["James Kirk", 34, "Captain", 2265] …
Read MoreUse enumerate to iterate to each list's element 1>>> # Pythonic Example 2>>> animals = ['cat', 'dog', 'moose'] 3>>> for i, animal in enumerate(animals): 4... print(i, animal) 5... 60 cat 71 dog 82 moose If the index is not important, use "_" in place of …
Read More