lewashby 56 Junior Poster

My daughter is into making youtube videos but she's been pretty disapointed in the camara/software that came with her laptop. I just purchased her an independant web cam but I need some suggestions on software for her to use for capturing and making her youtube videos. I can't remember if she's using Windows 8.1 or 10. Thanks.

lewashby 56 Junior Poster

I have a very small sqlite3 database with one row consisting of three columns but I can get the page to display the row to save my life. So far all I've been able to get the page to display is the first column of the one row that's in my DB using querySingle and echo $result. $entry doesn't seem to be doing anything neither does the bottomw while loop. Any ideas. All I want to do here is display the one row that's in my DB to the screen.

<?php
echo "<html>";
echo "<body>";
// get variable from html form
//$fName = $_POST['fname'];
//$lName = $_POST['lname'];
//$address = $_POST['email'];

$db = new SQLite3('./et.sqlite3', SQLITE3_OPEN_READWRITE);

if(!$db)
{
    echo "Could not open/access DB";
}
else
{
    echo "Database is here";
    //$result = $db->query('select * from customers');
    //var_dump($db->querySingle('select * from customers'));
    //print_r($db->querySingle('select * from customers', true));
    $result = $db->querySingle('select * from customers');
    echo $result;
    $query = sqlite_query($db, 'select * from customers');
    while($entry = sqlite_fetch_array($query, SQLITE_NUM))
    {
        echo $entry[0]." ".echo $entry[1]." ". echo $entry[2];
    }

    $i = 0;

    while($i < strlen($result))
    {
        echo $result[$i];
        $i++;
    }
}

echo "</body>";
echo "</html>";
?>
lewashby 56 Junior Poster
import pygame
from pygame.locals import *
from sys import exit

from random import *

pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)

while True:
    
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
            
    screen.lock()
    
    for count in range(10):
        random_color = (randint(0, 255), randint(0, 255), randint(0, 255))
        random_pos = (randint(0, 639), randint(0, 479))
        random_size = (639-randint(random_pos[0], 639), 479-randint(random_pos[1], 479))
        
        pygame.draw.rect(screen, random_color, Rect(random_pos, random_size))
    screen.unlock()
    
    pygame.display.update()

In the above code, why are the three lines following the second for loop encased in parentheses? And what is the last of those three lines.(639-randint? How did they just slap a number and a dash right in front of a function. Thanks for any and all replies.

On a side note, why doesn't python support function, method, and constructor overloading? And what does it do to compensate?

lewashby 56 Junior Poster

I'M used to using a DOS bases screen but I don't know how to get my code a run in that kind of a Window. How do I use the default Application Output? I don't know how to input information, you now like with a Console.ReadLiine(). It's just a regular text based screen and there's no where to input information. Thanks.

lewashby 56 Junior Poster

Is there a way that I can run my C# code in a traditional dos based screen unlike the white background my programs are running in at the moment? I looked though the preferences but couldn't find anything. Thanks.

lewashby 56 Junior Poster

In the code below, the only part I'M having trouble with is word[position]. I know this is something really simple but I've always had trouble understanding these kinds of statements. I know that it prints a random letter (position) from (word). What I don't know is why or how it does that. That's the part that never seems to get explained to me. How can you just put [] around part of a statement and everything just work right? Thanks. Please don't give me an answer like "because that's what's it mad to do. Explain it to me.

# Random Access
# Demonstrates string indexing

import random

word = "index"
print "The word is: ", word, "\n"

high = len(word)
low = -len(word)

for i in range(10):
    position = random.randrange(low, high)
    print "word[", position, "]\t", word[position]

raw_input("\n\nPress the enter key to exit.")
lewashby 56 Junior Poster

In the program be below, I'M having trouble with these few lines, remember, I'M new.

What's going on here? I'M just a little confused because there is (word) wraped in len().

position = random.randrange(len(word))

And what's going on with these two lines? Thanks.

jumble += word[position]
    word = word[:position] + word[(position + 1):]
# Word Jumble
#
# The computer picks a random word and then "jumbles" it
# The player has to guess the original word

import random

# create a sequence of words to choose from
WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone")

# pick one word randomly from the sequence
word = random.choice(WORDS)

# create a variable to use later to see if the guess is correct
correct = word

# create a jumbled version of the word
jumble = ""

while word:
    position = random.randrange(len(word))
    
    jumble += word[position]
    word = word[:position] + word[(position + 1):]
    
# start the game
print \
"""

            Welcome to Word Jumble!
            
        Unscramble the letters to make a word.
    (Press the enter key at the promt to quit.)
"""
print "The jumble is:", jumble

guess = raw_input("\nYour guess: ")
guess = guess.lower()

while(guess != correct) and (guess != ""):
    print "Sorry, that's not it."
    guess = raw_input("Your guess: ")
    guess = guess.lower()
    
if guess == correct:
    print "That's it! You guessed it!\n"
    
print "Thanks for playing."

raw_input("\n\nPress the enter key to exit.")