Write code that iterates while userNum is less than 10. Each iteration: Put userNum to output. Then, put "/" to output. Then, assign userNum with userNum multiplied by 3.
Added by Cheryl L.
Step 1
For this example, let's assume `userNum` is initialized to 1. Show more…
Show all steps
Your feedback will help us improve your experience
Liam Haas-Neill and 83 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write code that iterates while userNum is less than 14. Each iteration: Put userNum to output. Then, put "_" to output. Then, assign userNum with userNum multiplied by 3. Ex: If input is 1, then output is: 1_3_9_ integer userNum // Program will be tested with 1, 3, 5, and 14 userNum = Get next input // Your solution goes here
Samuel G.
Assign the value 5 to the variable guess_me. Use a for loop to iterate a variable called number over range(10). If number is less than guess_me,
Write a while loop that prints userNum divided by 4 (integer division) until reaching 2 or less. Follow each number by a space. Example output for userNum = 160:40 10 2
Liam H.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD