Nstructions
When we read code and predict its output, it is called tracing code.
For thi...
Computers and Technology, 12.10.2020 21:01, jair512872
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")
Answers: 1
Computers and Technology, 22.06.2019 21:00, jarrettashlyn
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr. nextdouble(); minutestraveled = scnr. nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system. out. println("miles: " + milestraveled); } }
Answers: 2
Computers and Technology, 23.06.2019 16:00, CalCDanG
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
Computers and Technology, 23.06.2019 21:50, Trinhphuongtran
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2