logo

Crowdly

Browser

Add to Chrome

Rekenaarwetenskap - Computer science - 113/114

Looking for Rekenaarwetenskap - Computer science - 113/114 test answers and solutions? Browse our comprehensive collection of verified answers for Rekenaarwetenskap - Computer science - 113/114 at stemlearn.sun.ac.za.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

What does the following Python program print to the screen when executed?

Wat druk die volgende Python program na die skerm wanneer dit uitgevoer word?

#--------------------------------

#ifexample1.py

import stdio

def main():

   X = 3

   Y = 7

   X = X + Y

Y = X - Y

X = X - Y

if not (3*X < 2*Y):

       X = 4*X + 3*Y

       Y = X*X + Y

    else:

       Y = Y*Y + 2*X**2

       X = X - Y

    stdio.writeln(str(X)+" "+str(Y))

if __name__ == "__main__": main()

#--------------------------------
View this question

What is printed to the screen if the following command is executed?

Wat word na die skerm gedruk as die volgende bevel uitgevoer word?

python3 usethree.py 2 1

#--------------------------------

#usethree.py

import stdio

import sys

def main():

if int(sys.argv[1])<int(sys.argv[2]):

   stdio.writeln("Hello "+sys.argv[1])

else:

      stdio.writeln("Hello "+sys.argv[2])

if __name__ == "__main__": main()

#--------------------------------
View this question

How many syntax errors does the following program contain?

Hoeveel sintaksfoute bevat die volgende program?

#--------------------------------

#usethree.py

import Stdio

import sys

Def Main():

   stdio.Writeln("Hello "sys.argv[3]+", "+sys.argv[2]+" and "+sys.argv[1])

if _name__ == "__main__": Main()

#--------------------------------

View this question

Want instant access to all verified answers on stemlearn.sun.ac.za?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome