File tree Expand file tree Collapse file tree 13 files changed +83
-89
lines changed Expand file tree Collapse file tree 13 files changed +83
-89
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,9 @@ func main() {
10
10
// You can use print statements as follows for debugging, they'll be visible when running tests.
11
11
fmt .Println ("Logs from your program will appear here!" )
12
12
13
- reader := bufio .NewReader (os .Stdin )
14
- for {
15
- // Uncomment this block to pass the first stage
16
- // fmt.Fprint(os.Stdout, "$ ")
17
- _ , _ = reader .ReadString ('\n' )
18
- }
13
+ // Uncomment this block to pass the first stage
14
+ // fmt.Fprint(os.Stdout, "$ ")
15
+
16
+ // Wait for user input
17
+ bufio .NewReader (os .Stdin ).ReadString ('\n' )
19
18
}
Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ def main():
5
5
# You can use print statements as follows for debugging, they'll be visible when running tests.
6
6
print ("Logs from your program will appear here!" )
7
7
8
- while True :
9
- # Uncomment this block to pass the first stage
10
- # sys.stdout.write("$ ")
11
- # sys.stdout.flush()
12
- input ()
8
+ # Uncomment this block to pass the first stage
9
+ # sys.stdout.write("$ ")
10
+ # sys.stdout.flush()
11
+
12
+ # Wait for user input
13
+ input ()
13
14
14
15
15
16
if __name__ == "__main__" :
Original file line number Diff line number Diff line change
1
+ #[ allow( unused_imports) ]
1
2
use std:: io:: { self , Write } ;
2
3
3
4
fn main ( ) {
4
5
// You can use print statements as follows for debugging, they'll be visible when running tests.
5
6
println ! ( "Logs from your program will appear here!" ) ;
6
7
7
8
// Uncomment this block to pass the first stage
8
- // let stdin = io::stdin( );
9
- // loop {
10
- // print!("$ ");
11
- // io::stdout().flush().unwrap();
12
- // let mut input = String::new ();
13
- // stdin.read_line(& mut input).unwrap ();
14
- // }
9
+ // print!("$ " );
10
+ // io::stdout().flush().unwrap();
11
+
12
+ // Wait for user input
13
+ let stdin = io :: stdin ( ) ;
14
+ let mut input = String :: new ( ) ;
15
+ stdin . read_line ( & mut input ) . unwrap ( ) ;
15
16
}
Original file line number Diff line number Diff line change 7
7
)
8
8
9
9
func main () {
10
- reader := bufio .NewReader (os .Stdin )
11
- for {
12
- fmt .Fprint (os .Stdout , "$ " )
13
- _ , _ = reader .ReadString ('\n' )
14
- }
10
+ fmt .Fprint (os .Stdout , "$ " )
11
+
12
+ // Wait for user input
13
+ bufio .NewReader (os .Stdin ).ReadString ('\n' )
15
14
}
Original file line number Diff line number Diff line change 1
- @@ -1,19 +1,15 @@
1
+ @@ -1,18 +1,14 @@
2
2
package main
3
3
4
4
import (
11
11
- // You can use print statements as follows for debugging, they'll be visible when running tests.
12
12
- fmt.Println("Logs from your program will appear here!")
13
13
-
14
- reader := bufio.NewReader(os.Stdin)
15
- for {
16
- - // Uncomment this block to pass the first stage
17
- - // fmt.Fprint(os.Stdout, "$ ")
18
- + fmt.Fprint(os.Stdout, "$ ")
19
- _, _ = reader.ReadString('\n')
20
- }
14
+ - // Uncomment this block to pass the first stage
15
+ - // fmt.Fprint(os.Stdout, "$ ")
16
+ + fmt.Fprint(os.Stdout, "$ ")
17
+
18
+ // Wait for user input
19
+ bufio.NewReader(os.Stdin).ReadString('\n')
21
20
}
Original file line number Diff line number Diff line change 2
2
3
3
4
4
def main ():
5
- while True :
6
- sys .stdout .write ("$ " )
7
- sys .stdout .flush ()
8
- input ()
5
+ sys .stdout .write ("$ " )
6
+ sys .stdout .flush ()
7
+
8
+ # Wait for user input
9
+ input ()
9
10
10
11
11
12
if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1
- @@ -1,16 +1,12 @@
1
+ @@ -1,17 +1,13 @@
2
2
import sys
3
3
4
4
5
5
def main():
6
6
- # You can use print statements as follows for debugging, they'll be visible when running tests.
7
7
- print("Logs from your program will appear here!")
8
8
-
9
- while True:
10
- - # Uncomment this block to pass the first stage
11
- - # sys.stdout.write("$ ")
12
- - # sys.stdout.flush()
13
- + sys.stdout.write("$ ")
14
- + sys.stdout.flush()
15
- input()
9
+ - # Uncomment this block to pass the first stage
10
+ - # sys.stdout.write("$ ")
11
+ - # sys.stdout.flush()
12
+ + sys.stdout.write("$ ")
13
+ + sys.stdout.flush()
14
+
15
+ # Wait for user input
16
+ input()
16
17
17
18
18
19
if __name__ == "__main__":
Original file line number Diff line number Diff line change
1
+ #[ allow( unused_imports) ]
1
2
use std:: io:: { self , Write } ;
2
3
3
4
fn main ( ) {
5
+ print ! ( "$ " ) ;
6
+ io:: stdout ( ) . flush ( ) . unwrap ( ) ;
7
+
8
+ // Wait for user input
4
9
let stdin = io:: stdin ( ) ;
5
- loop {
6
- print ! ( "$ " ) ;
7
- io:: stdout ( ) . flush ( ) . unwrap ( ) ;
8
- let mut input = String :: new ( ) ;
9
- stdin. read_line ( & mut input) . unwrap ( ) ;
10
- }
10
+ let mut input = String :: new ( ) ;
11
+ stdin. read_line ( & mut input) . unwrap ( ) ;
11
12
}
Original file line number Diff line number Diff line change 1
- @@ -1,15 +1,11 @@
1
+ @@ -1,16 +1,12 @@
2
+ #[allow(unused_imports)]
2
3
use std::io::{self, Write};
3
4
4
5
fn main() {
5
6
- // You can use print statements as follows for debugging, they'll be visible when running tests.
6
7
- println!("Logs from your program will appear here!");
7
8
-
8
9
- // Uncomment this block to pass the first stage
9
- - // let stdin = io::stdin();
10
- - // loop {
11
- - // print!("$ ");
12
- - // io::stdout().flush().unwrap();
13
- - // let mut input = String::new();
14
- - // stdin.read_line(&mut input).unwrap();
15
- - // }
16
- + let stdin = io::stdin();
17
- + loop {
18
- + print!("$ ");
19
- + io::stdout().flush().unwrap();
20
- + let mut input = String::new();
21
- + stdin.read_line(&mut input).unwrap();
22
- + }
10
+ - // print!("$ ");
11
+ - // io::stdout().flush().unwrap();
12
+ + print!("$ ");
13
+ + io::stdout().flush().unwrap();
14
+
15
+ // Wait for user input
16
+ let stdin = io::stdin();
17
+ let mut input = String::new();
18
+ stdin.read_line(&mut input).unwrap();
23
19
}
Original file line number Diff line number Diff line change @@ -4,13 +4,8 @@ Study and uncomment the relevant code:
4
4
5
5
``` rust
6
6
// Uncomment this block to pass the first stage
7
- let stdin = io :: stdin ();
8
- loop {
9
- print! (" $ " );
10
- io :: stdout (). flush (). unwrap ();
11
- let mut input = String :: new ();
12
- stdin . read_line (& mut input ). unwrap ();
13
- }
7
+ print! (" $ " );
8
+ io :: stdout (). flush (). unwrap ();
14
9
```
15
10
16
11
Push your changes to pass the first stage:
Original file line number Diff line number Diff line change @@ -10,10 +10,9 @@ func main() {
10
10
// You can use print statements as follows for debugging, they'll be visible when running tests.
11
11
fmt .Println ("Logs from your program will appear here!" )
12
12
13
- reader := bufio .NewReader (os .Stdin )
14
- for {
15
- // Uncomment this block to pass the first stage
16
- // fmt.Fprint(os.Stdout, "$ ")
17
- _ , _ = reader .ReadString ('\n' )
18
- }
13
+ // Uncomment this block to pass the first stage
14
+ // fmt.Fprint(os.Stdout, "$ ")
15
+
16
+ // Wait for user input
17
+ bufio .NewReader (os .Stdin ).ReadString ('\n' )
19
18
}
Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ def main():
5
5
# You can use print statements as follows for debugging, they'll be visible when running tests.
6
6
print ("Logs from your program will appear here!" )
7
7
8
- while True :
9
- # Uncomment this block to pass the first stage
10
- # sys.stdout.write("$ ")
11
- # sys.stdout.flush()
12
- input ()
8
+ # Uncomment this block to pass the first stage
9
+ # sys.stdout.write("$ ")
10
+ # sys.stdout.flush()
11
+
12
+ # Wait for user input
13
+ input ()
13
14
14
15
15
16
if __name__ == "__main__" :
Original file line number Diff line number Diff line change
1
+ #[ allow( unused_imports) ]
1
2
use std:: io:: { self , Write } ;
2
3
3
4
fn main ( ) {
4
5
// You can use print statements as follows for debugging, they'll be visible when running tests.
5
6
println ! ( "Logs from your program will appear here!" ) ;
6
7
7
8
// Uncomment this block to pass the first stage
8
- // let stdin = io::stdin( );
9
- // loop {
10
- // print!("$ ");
11
- // io::stdout().flush().unwrap();
12
- // let mut input = String::new ();
13
- // stdin.read_line(& mut input).unwrap ();
14
- // }
9
+ // print!("$ " );
10
+ // io::stdout().flush().unwrap();
11
+
12
+ // Wait for user input
13
+ let stdin = io :: stdin ( ) ;
14
+ let mut input = String :: new ( ) ;
15
+ stdin . read_line ( & mut input ) . unwrap ( ) ;
15
16
}
You can’t perform that action at this time.
0 commit comments