Aug-14-2018, 07:25 AM
yet another homework question
yet another homework question
|
||||||||||||||||
Aug-14-2018, 03:42 PM
(This post was last modified: Aug-15-2018, 05:39 AM by HakolYahol.)
i'm reading your responses now
it will take me time to answer back for now thank you :) (Aug-13-2018, 08:51 PM)Fab95 Wrote: I agree that you should try harder by yourself. Yet I'm learning too and specially trying hard to manage loops. Although I think this exercise was not really hard to solve. wait a moment. thank you but what if the for loops are only learned a chapter after?
Aug-16-2018, 09:37 AM
As a beginner myself, I will ask that if you were not yet taught about the for loop until the next chapter, were you taught the while loop already, while True: is a favorite way to repeat something again and again, were you taught how to count and keep a running total for three different items such as heads and tails and total coin tosses, were you taught how to use an if statement, a nested if statement, an elif statement and a break statement after reaching the end of the program? These are the minimum items I can think of without using a for loop. You actually may not need to count tails as total tosses minus heads implies tails. I don't think they want you to copy / paste a simple code 100 times and keep count along the way. Do you know how to import Random, was that taught also? What are your thoughts of the book now?
Aug-16-2018, 10:41 AM
(Aug-14-2018, 03:42 PM)HakolYahol Wrote: wait a moment. The while True solution would be the following:
Aug-16-2018, 06:49 PM
To make the code happy as to PEP8 style:
Does this work?
Sep-27-2018, 04:52 PM
(This post was last modified: Sep-27-2018, 04:52 PM by gruntfutuk.)
Simplified, but still using
while instead of for
var += 1 is the same as var = var + 1 (well, technically, it isn't but you don't need to worry about that here)
I am trying to help you, really, even if it doesn't always seem that way
| ||||||||||||||||
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Homework help:While Loops question | Midhat_School | 6 | 4,265 |
Jul-26-2020, 10:23 AM Last Post: pyzyx3qwerty |
|
IF ELSE Homework Question | buckthimble | 1 | 2,718 |
Mar-29-2020, 06:29 AM Last Post: buran |
|
Python Homework Question | OrcDroid123 | 1 | 3,104 |
Sep-01-2019, 08:44 AM Last Post: buran |
|
Homework question | dmhhfm | 4 | 14,665 |
Apr-10-2019, 07:22 AM Last Post: DeaD_EyE |
|
Beginner Python Homework Question (Calculate Gross Pay) | matchamochi7 | 4 | 6,733 |
Nov-02-2018, 01:06 PM Last Post: buran |
|
python in JES homework question, | lsteffen | 1 | 3,632 |
Feb-11-2018, 05:52 PM Last Post: Taco_Town |
Users browsing this thread: 1 Guest(s)