subject

Nstructions When we read code and predict its output, it is called tracing code.

For this lesson, you will come up with your own challenging algorithm for other students to trace. It must contain at least 5 if statements and use at least one AND or OR boolean condition.

Note: Elif or else statements will not count - your statements must be if statements. Each if statement should use a unique
For this challenge, try reading 3 or 4 of your classmates' code as well. Trace their code and predict what it will output, then check the code by running it to see if you got it right, and submit your work for a grade

name = input("What's your name?")

if name == "no" or name == "NO" or name == "name":
print("That's not a name!")
else:
print("Hello " + name)

age = int(input("How old are you?"))

if age < 13:
print("Why are you on the Internet??")
elif age < 18:
print("High school's cool")
else:
print("Wow, a real adult!")

dogs = input("Do you like dogs?")

if dogs == "yes" or dogs == "YES":
fish = input("Do you also like fish?")

if fish == "yes" or fish == "YES":
print("What an animal lover!")
else:
print("Yeah, dogs are great!")
else:
cats = input("What about cats?")

if cats == "no" or cats == "NO":
print("Maybe horses or bunnies?")
else:
print("Cats are cool")

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:00, jgrable5175
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
image
Computers and Technology, 22.06.2019 17:40, lazerlemon500
Write a modular program (no classes yet, just from what you learned last year), that allows two players to play a game of tic-tac-toe. use a two-dimensional char array with 3 rows and 3 columns as the game board. each element of the array should be initialized with an asterisk (*). the program should display the initial board configuration and then start a loop that does the following: allow player 1 to select a location on the board for an x by entering a row and column number. then redisplay the board with an x replacing the * in the chosen location. if there is no winner yet and the board is not yet full, allow player 2 to select a location on the board for an o by entering a row and column number. then redisplay the board with an o replacing the * in the chosen location. the loop should continue until a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred. player 1 wins when there are three xs in a row, a column, or a diagonal on the game board. player 2 wins when there are three ox in a row, a column, or a diagonal on the game board. a tie occurs when all of the locations on the board are full, but there is no winner. input validation: only allow legal moves to be entered. the row must be 1, 2, or 3. the column must be 1, 2 3. the (row, column) position entered must currently be empty (i. e., still have an asterisk in it).
Answers: 1
image
Computers and Technology, 24.06.2019 09:50, trenrain
Create a string list. 2. use console. readline() to collect values of firstname, lastname, street, city, state, zip, save them to list. 3. write a simple linq statement, call method uppercasewords() to change first letter to uppercase. 4. create a foreach statment to display the information. public static string uppercasewords(string value) { char[] array = value. tochararray(); if (array. length > = 1) { if (char. islower(array[0])) { array[0] = char. toupper(array[0]); } } for (int i = 1; i < array. length; i++) { if (array[i - 1] == ' ') { if (char. islower(array[i])) { array[i] = char. toupper(array[i]); } } } return new string(array);
Answers: 3
image
Computers and Technology, 25.06.2019 05:00, aprilkenedy12
How many meatballs required for a larty of 25 adults and 6 children
Answers: 1
You know the right answer?
Nstructions When we read code and predict its output, it is called tracing code.

For thi...

Questions in other subjects:

Konu
Mathematics, 12.09.2019 06:10
Konu
Mathematics, 12.09.2019 06:10
Konu
English, 12.09.2019 06:10