From 4afa59fbe2f997b4b728a4be0c396452304c1b98 Mon Sep 17 00:00:00 2001 From: country cousin Date: Mon, 4 Mar 2024 18:05:04 +0100 Subject: [PATCH 1/4] adding println --- exercises/arrays/arrays3.cairo | 1 + exercises/dict/dict2.cairo | 2 +- exercises/enums/enums1.cairo | 11 +++++----- exercises/enums/enums2.cairo | 18 +++++++-------- exercises/enums/enums3.cairo | 4 ++-- exercises/functions/functions2.cairo | 3 +-- exercises/functions/functions3.cairo | 5 +++-- exercises/functions/functions4.cairo | 4 ++-- exercises/if/if1.cairo | 1 + exercises/if/if2.cairo | 2 +- exercises/intro/intro2.cairo | 1 + exercises/loops/loops2.cairo | 2 +- exercises/modules/modules1.cairo | 1 + exercises/modules/modules2.cairo | 2 +- exercises/operations/operations1.cairo | 1 - exercises/options/options2.cairo | 4 ++-- exercises/options/options3.cairo | 6 +++-- .../primitive_types/primitive_types1.cairo | 8 ++++--- .../primitive_types/primitive_types2.cairo | 22 ++++++++++++------- .../primitive_types/primitive_types3.cairo | 6 ++--- exercises/quizs/quizs1.cairo | 1 + exercises/starknet/basics/starknet4.cairo | 1 + exercises/structs/structs3.cairo | 2 +- exercises/traits/traits3.cairo | 1 + exercises/variables/variables1.cairo | 7 +++--- exercises/variables/variables2.cairo | 4 ++-- exercises/variables/variables3.cairo | 2 +- exercises/variables/variables4.cairo | 4 ++-- exercises/variables/variables5.cairo | 4 ++-- exercises/variables/variables6.cairo | 4 ++-- 30 files changed, 76 insertions(+), 58 deletions(-) diff --git a/exercises/arrays/arrays3.cairo b/exercises/arrays/arrays3.cairo index 5a66fe8fd..95975eaf3 100644 --- a/exercises/arrays/arrays3.cairo +++ b/exercises/arrays/arrays3.cairo @@ -24,3 +24,4 @@ fn test_arrays3() { // You should not change the index accessed. a.at(2); } + \ No newline at end of file diff --git a/exercises/dict/dict2.cairo b/exercises/dict/dict2.cairo index 156eb8857..6a0025ab6 100644 --- a/exercises/dict/dict2.cairo +++ b/exercises/dict/dict2.cairo @@ -11,7 +11,7 @@ fn multiply_element_by_10(ref dict: Felt252Dict, n: usize) { //TODO : make a function that multiplies the elements stored at the indexes 0 to n of a dictionary by 10 - + } // Don't change anything in the test diff --git a/exercises/enums/enums1.cairo b/exercises/enums/enums1.cairo index d425f395a..da02ef0f0 100644 --- a/exercises/enums/enums1.cairo +++ b/exercises/enums/enums1.cairo @@ -3,7 +3,7 @@ // I AM NOT DONE -use debug::print; + use debug::PrintTrait; enum Message { // TODO: define a few types of messages as used below } @@ -18,10 +18,11 @@ fn main() { impl MessagePrintImpl of PrintTrait { fn print(self: Message) { match self { - Message::Quit => ('Quit').print(), - Message::Echo => ('Echo').print(), - Message::Move => ('Move').print(), - Message::ChangeColor => ('ChangeColor').print() + + Message::Quit => println!("Quit"), + Message::Echo => println!("Echo"), + Message::Move => println!("Move"), + Message::ChangeColor => println!("ChangeColor") } } } diff --git a/exercises/enums/enums2.cairo b/exercises/enums/enums2.cairo index 445c895a6..33e245662 100644 --- a/exercises/enums/enums2.cairo +++ b/exercises/enums/enums2.cairo @@ -54,20 +54,20 @@ fn print_messages_recursive(messages: Array, index: u32) { impl MessagePrintImpl of PrintTrait { fn print(self: Message) { - ('___MESSAGE BEGINS___').print(); + println!("___MESSAGE BEGINS___"); match self { - Message::Quit => ('Quit').print(), - Message::Echo(msg) => msg.print(), + Message::Quit => println!("Quit"), + Message::Echo(msg) => println!("{}", msg), Message::Move((a, b)) => { - a.print(); - b.print(); + println!("{}", a); + println!("{}",b); }, Message::ChangeColor((red, green, blue)) => { - red.print(); - green.print(); - blue.print(); + println!("{}",red); + println!("{}",green); + println!("{}",blue); } } - ('___MESSAGE ENDS___').print(); + println!("___MESSAGE ENDS___"); } } diff --git a/exercises/enums/enums3.cairo b/exercises/enums/enums3.cairo index 0b7c9b632..93a66595d 100644 --- a/exercises/enums/enums3.cairo +++ b/exercises/enums/enums3.cairo @@ -2,7 +2,7 @@ // Address all the TODOs to make the tests pass! // Execute `starklings hint enums3` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE +// I AM NOT DONE print use debug::PrintTrait; @@ -41,7 +41,7 @@ impl StateImpl of StateTrait { } fn echo(ref self: State, s: felt252) { - s.print(); + println!("{}", s); } fn move_position(ref self: State, p: Point) { diff --git a/exercises/functions/functions2.cairo b/exercises/functions/functions2.cairo index 9a65c72a8..f43a9a295 100644 --- a/exercises/functions/functions2.cairo +++ b/exercises/functions/functions2.cairo @@ -2,12 +2,11 @@ // Execute `starklings hint functions2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { call_me(3); } fn call_me(num:) { - num.print(); + println!("num is {}", num); } diff --git a/exercises/functions/functions3.cairo b/exercises/functions/functions3.cairo index 7eb6d6742..27e152440 100644 --- a/exercises/functions/functions3.cairo +++ b/exercises/functions/functions3.cairo @@ -2,12 +2,13 @@ // Execute `starklings hint functions3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; + fn main() { call_me(); } fn call_me(num: u64) { - num.print(); + + println!("num is {}", num); } diff --git a/exercises/functions/functions4.cairo b/exercises/functions/functions4.cairo index b21f5cbee..d69217a09 100644 --- a/exercises/functions/functions4.cairo +++ b/exercises/functions/functions4.cairo @@ -8,11 +8,11 @@ // to future exercises!) // I AM NOT DONE -use debug::PrintTrait; + fn main() { let original_price = 51; - sale_price(original_price).print(); + println!("sale_price is {}", sale_price(original_price)); } fn sale_price(price: u32) -> { diff --git a/exercises/if/if1.cairo b/exercises/if/if1.cairo index 981f4a0a9..89329f05f 100644 --- a/exercises/if/if1.cairo +++ b/exercises/if/if1.cairo @@ -24,3 +24,4 @@ mod tests { assert(42 == bigger(32, 42), '42 bigger than 32'); } } + \ No newline at end of file diff --git a/exercises/if/if2.cairo b/exercises/if/if2.cairo index 151a493c3..ab48caad2 100644 --- a/exercises/if/if2.cairo +++ b/exercises/if/if2.cairo @@ -38,4 +38,4 @@ mod tests { fn default_to_baz() { assert(foo_if_fizz('literally anything') == 'baz', 'anything else returns baz'); } -} +} diff --git a/exercises/intro/intro2.cairo b/exercises/intro/intro2.cairo index 29604faa8..799b5ddc3 100644 --- a/exercises/intro/intro2.cairo +++ b/exercises/intro/intro2.cairo @@ -2,3 +2,4 @@ // This exercise won't compile... Can you make it compile? +fn main(){} \ No newline at end of file diff --git a/exercises/loops/loops2.cairo b/exercises/loops/loops2.cairo index 5a4ba9435..2f6fbceab 100644 --- a/exercises/loops/loops2.cairo +++ b/exercises/loops/loops2.cairo @@ -16,4 +16,4 @@ fn test_loop() { }; assert(result == 5, 'result should be 5'); -} +} diff --git a/exercises/modules/modules1.cairo b/exercises/modules/modules1.cairo index 9cc95052d..0772435f1 100644 --- a/exercises/modules/modules1.cairo +++ b/exercises/modules/modules1.cairo @@ -28,3 +28,4 @@ mod tests { assert(order_result == 'order_taken', 'Order not taken'); } } + \ No newline at end of file diff --git a/exercises/modules/modules2.cairo b/exercises/modules/modules2.cairo index 2f67a8ce3..fe127408f 100644 --- a/exercises/modules/modules2.cairo +++ b/exercises/modules/modules2.cairo @@ -2,7 +2,7 @@ // These modules have some issues, can you fix? // Run `starklings hint modules2` or `hint` watch command for a hint. -use debug::PrintTrait; +// use debug::PrintTrait; const YEAR: u16 = 2050; mod order { diff --git a/exercises/operations/operations1.cairo b/exercises/operations/operations1.cairo index d6f689734..e82d20673 100644 --- a/exercises/operations/operations1.cairo +++ b/exercises/operations/operations1.cairo @@ -6,7 +6,6 @@ // TODO // Return the solution of x^3 + y - 2 -use debug::PrintTrait; fn poly(x: usize, y: usize) -> usize { // FILL ME diff --git a/exercises/options/options2.cairo b/exercises/options/options2.cairo index 7999676fb..354b53d52 100644 --- a/exercises/options/options2.cairo +++ b/exercises/options/options2.cairo @@ -4,7 +4,7 @@ // I AM NOT DONE use option::OptionTrait; -use debug::PrintTrait; + #[test] fn test_options() { @@ -19,5 +19,5 @@ fn simple_option(optional_target: Option) { // TODO: use the `is_some` and `is_none` methods to check if `optional_target` contains a value. // Place the assertion and the print statement below in the correct blocks. assert(optional_target.unwrap() == 'starklings', 'err1'); - ('option is empty !').print(); + println!(" option is empty ! "); } diff --git a/exercises/options/options3.cairo b/exercises/options/options3.cairo index c5e9c9de2..9b93c4766 100644 --- a/exercises/options/options3.cairo +++ b/exercises/options/options3.cairo @@ -4,7 +4,6 @@ // I AM NOT DONE use option::OptionTrait; -use debug::PrintTrait; use array::ArrayTrait; #[derive(Drop)] @@ -41,8 +40,11 @@ fn display_grades(student: @Student, index: usize) { // TODO: Modify the following lines so that if there is a grade for the course, it is printed. // Otherwise, print "No grade". // - course.unwrap().print(); + + println!("grade is {}", course.unwrap()); display_grades(student, index + 1); + + } diff --git a/exercises/primitive_types/primitive_types1.cairo b/exercises/primitive_types/primitive_types1.cairo index 0277d90ef..a57525063 100644 --- a/exercises/primitive_types/primitive_types1.cairo +++ b/exercises/primitive_types/primitive_types1.cairo @@ -4,18 +4,20 @@ // I AM NOT DONE -use debug::PrintTrait; + fn main() { // Booleans (`bool`) let is_morning = true; if is_morning { - ('Good morning!').print(); + + println!("Good morning!"); } let // Finish the rest of this line like the example! Or make it be false! if is_evening { - ('Good evening!').print(); + + println!("Good evening!"); } } diff --git a/exercises/primitive_types/primitive_types2.cairo b/exercises/primitive_types/primitive_types2.cairo index aa0360a0a..bc50468d7 100644 --- a/exercises/primitive_types/primitive_types2.cairo +++ b/exercises/primitive_types/primitive_types2.cairo @@ -4,7 +4,7 @@ // I AM NOT DONE -use debug::PrintTrait; + fn main() { // A short string is a string whose length is at most 31 characters, and therefore can fit into a single field element. @@ -15,27 +15,33 @@ fn main() { if is_alphabetic( ref my_first_initial ) { - ('Alphabetical!').print(); + + println!(" Alphabetical !"); } else if is_numeric( ref my_first_initial ) { - ('Numerical!').print(); + + println!(" Numerical !"); } else { - ('Neither alphabetic nor numeric!').print(); + + println!(" Neither alphabetic nor numeric!"); } - let // Finish this line like the example! What's your favorite short string? + let // Finish this line like the example! What's your favorite short string? // Try a letter, try a number, try a special character, try a short string! if is_alphabetic( ref your_character ) { - ('Alphabetical!').print(); + + println!(" Alphabetical !"); } else if is_numeric( ref your_character ) { - ('Numerical!').print(); + + println!(" Numerical!"); } else { - ('Neither alphabetic nor numeric!').print(); + + println!(" Neither alphabetic nor numeric!"); } } diff --git a/exercises/primitive_types/primitive_types3.cairo b/exercises/primitive_types/primitive_types3.cairo index c70193b76..72e7312ae 100644 --- a/exercises/primitive_types/primitive_types3.cairo +++ b/exercises/primitive_types/primitive_types3.cairo @@ -4,11 +4,11 @@ // I AM NOT DONE -use debug::PrintTrait; + fn main() { let cat = ('Furry McFurson', 3); let // your pattern here = cat; - name.print(); - age.print(); + println!("name is {}", name); + println!("age is {}", age); } diff --git a/exercises/quizs/quizs1.cairo b/exercises/quizs/quizs1.cairo index 1f26c3060..812d40377 100644 --- a/exercises/quizs/quizs1.cairo +++ b/exercises/quizs/quizs1.cairo @@ -24,3 +24,4 @@ fn verify_test() { assert(82 == price3, 'Incorrect price'); assert(130 == price4, 'Incorrect price'); } + \ No newline at end of file diff --git a/exercises/starknet/basics/starknet4.cairo b/exercises/starknet/basics/starknet4.cairo index 35edd69b9..b59655992 100644 --- a/exercises/starknet/basics/starknet4.cairo +++ b/exercises/starknet/basics/starknet4.cairo @@ -163,3 +163,4 @@ mod test { contract0 } } + \ No newline at end of file diff --git a/exercises/structs/structs3.cairo b/exercises/structs/structs3.cairo index 21d04b513..0642f109a 100644 --- a/exercises/structs/structs3.cairo +++ b/exercises/structs/structs3.cairo @@ -79,4 +79,4 @@ fn calculate_transport_fees() { assert(package.get_fees(cents_per_gram) == 4500, 'Wrong fees'); } - + diff --git a/exercises/traits/traits3.cairo b/exercises/traits/traits3.cairo index 6acf198d7..648323aa4 100644 --- a/exercises/traits/traits3.cairo +++ b/exercises/traits/traits3.cairo @@ -76,3 +76,4 @@ fn test_traits3() { assert(dog.make_noise() == 'woof', 'Wrong noise'); assert(dog.get_distance() == 1, 'Wrong distance'); } + diff --git a/exercises/variables/variables1.cairo b/exercises/variables/variables1.cairo index 081911134..47651ba59 100644 --- a/exercises/variables/variables1.cairo +++ b/exercises/variables/variables1.cairo @@ -2,11 +2,12 @@ // Make me compile! // Execute `starklings hint variables1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE +// I AM NOT DONE use debug::PrintTrait; fn main() { - x = 5; - x.print(); + x = 5 ; + // x.print(); + println!(" x is {}", x) } diff --git a/exercises/variables/variables2.cairo b/exercises/variables/variables2.cairo index 9c580a9f7..f8fec80ad 100644 --- a/exercises/variables/variables2.cairo +++ b/exercises/variables/variables2.cairo @@ -7,8 +7,8 @@ use debug::PrintTrait; fn main() { let x; if x == 10 { - ('x is ten!').print(); + println!("x is ten! "); } else { - ('x is not ten!').print(); + println!("x is not ten! "); } } diff --git a/exercises/variables/variables3.cairo b/exercises/variables/variables3.cairo index 84dd25e17..a6bfe4d32 100644 --- a/exercises/variables/variables3.cairo +++ b/exercises/variables/variables3.cairo @@ -6,5 +6,5 @@ use debug::PrintTrait; fn main() { let x: felt252; - x.print(); + println!("x is {}", x); } diff --git a/exercises/variables/variables4.cairo b/exercises/variables/variables4.cairo index 30826e789..dc5197628 100644 --- a/exercises/variables/variables4.cairo +++ b/exercises/variables/variables4.cairo @@ -6,7 +6,7 @@ use debug::PrintTrait; fn main() { let x = 3; - x.print(); + println!("x is {}", x); x = 5; // don't change this line - x.print(); + println!("x is now {}", x); } diff --git a/exercises/variables/variables5.cairo b/exercises/variables/variables5.cairo index 1e422aa69..9a4256efa 100644 --- a/exercises/variables/variables5.cairo +++ b/exercises/variables/variables5.cairo @@ -6,7 +6,7 @@ use debug::PrintTrait; fn main() { let number = 1_u8; // don't change this line - number.print(); + println!("number is {}", number); number = 3; // don't rename this variable - number.print(); + println!("number is {}", number); } diff --git a/exercises/variables/variables6.cairo b/exercises/variables/variables6.cairo index c4bba1f13..2d84320a6 100644 --- a/exercises/variables/variables6.cairo +++ b/exercises/variables/variables6.cairo @@ -7,6 +7,6 @@ use debug::PrintTrait; const NUMBER = 3; const SMALL_NUMBER = 3_u8; fn main() { - NUMBER.print(); - SMALL_NUMBER.print(); + println!("NUMBER is {}", NUMBER); + println!("SMALL_NUMBER is {}", SMALL_NUMBER); } From 067e5f60d7fb6ce9cdeb93663004ed9a233d17d5 Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Fri, 15 Mar 2024 15:52:34 +0530 Subject: [PATCH 2/4] cleanup --- corelib/Scarb.lock | 2 +- exercises/arrays/arrays3.cairo | 1 - exercises/dict/dict1.cairo | 3 +-- exercises/dict/dict2.cairo | 3 +-- exercises/dict/dict3.cairo | 11 +++-------- exercises/enums/enums1.cairo | 6 ++---- exercises/enums/enums3.cairo | 2 +- exercises/functions/functions3.cairo | 2 -- exercises/functions/functions4.cairo | 1 - exercises/if/if1.cairo | 1 - exercises/if/if2.cairo | 2 +- exercises/intro/intro2.cairo | 1 - exercises/loops/loops2.cairo | 2 +- exercises/modules/modules1.cairo | 1 - exercises/primitive_types/primitive_types1.cairo | 2 -- exercises/primitive_types/primitive_types2.cairo | 2 -- exercises/primitive_types/primitive_types3.cairo | 2 -- exercises/quizs/quizs1.cairo | 1 - exercises/starknet/basics/starknet4.cairo | 1 - exercises/structs/structs3.cairo | 2 +- exercises/traits/traits3.cairo | 1 - exercises/variables/variables1.cairo | 2 +- 22 files changed, 13 insertions(+), 38 deletions(-) diff --git a/corelib/Scarb.lock b/corelib/Scarb.lock index 0bd6895c9..18d39df00 100644 --- a/corelib/Scarb.lock +++ b/corelib/Scarb.lock @@ -3,4 +3,4 @@ version = 1 [[package]] name = "core" -version = "2.4.1" +version = "2.5.3" diff --git a/exercises/arrays/arrays3.cairo b/exercises/arrays/arrays3.cairo index 95975eaf3..5a66fe8fd 100644 --- a/exercises/arrays/arrays3.cairo +++ b/exercises/arrays/arrays3.cairo @@ -24,4 +24,3 @@ fn test_arrays3() { // You should not change the index accessed. a.at(2); } - \ No newline at end of file diff --git a/exercises/dict/dict1.cairo b/exercises/dict/dict1.cairo index de389fd96..31ee23581 100644 --- a/exercises/dict/dict1.cairo +++ b/exercises/dict/dict1.cairo @@ -10,10 +10,9 @@ // I AM NOT DONE - fn create_dictionary() -> Felt252Dict { let mut dict: Felt252Dict = Default::default(); - //TODO +//TODO } diff --git a/exercises/dict/dict2.cairo b/exercises/dict/dict2.cairo index 6a0025ab6..3f1469343 100644 --- a/exercises/dict/dict2.cairo +++ b/exercises/dict/dict2.cairo @@ -7,11 +7,10 @@ // I AM NOT DONE - fn multiply_element_by_10(ref dict: Felt252Dict, n: usize) { //TODO : make a function that multiplies the elements stored at the indexes 0 to n of a dictionary by 10 - + } // Don't change anything in the test diff --git a/exercises/dict/dict3.cairo b/exercises/dict/dict3.cairo index aef34eb29..5b6a0e30f 100644 --- a/exercises/dict/dict3.cairo +++ b/exercises/dict/dict3.cairo @@ -7,14 +7,12 @@ // Make me compile and pass the test! // Execute `starklings hint dict3` or use the `hint` watch subcommand for a hint. - // I AM NOT DONE - #[derive(Destruct)] struct Team { - level: Felt252Dict, - players_count: usize + level: Felt252Dict, + players_count: usize } #[generate_trait] @@ -41,11 +39,9 @@ impl TeamImpl of TeamTrait { } - #[test] #[available_gas(200000)] fn test_add_player() { - let mut team = TeamTrait::new(); team.add_player('bob', 10); team.add_player('alice', 20); @@ -58,9 +54,8 @@ fn test_add_player() { #[test] #[available_gas(200000)] fn test_level_up() { - let mut team = TeamTrait::new(); - team.add_player('bobby',10); + team.add_player('bobby', 10); team.level_up('bobby'); assert(team.level.get('bobby') == 11, 'Wrong level'); diff --git a/exercises/enums/enums1.cairo b/exercises/enums/enums1.cairo index da02ef0f0..93575091a 100644 --- a/exercises/enums/enums1.cairo +++ b/exercises/enums/enums1.cairo @@ -3,7 +3,6 @@ // I AM NOT DONE - use debug::PrintTrait; enum Message { // TODO: define a few types of messages as used below } @@ -18,9 +17,8 @@ fn main() { impl MessagePrintImpl of PrintTrait { fn print(self: Message) { match self { - - Message::Quit => println!("Quit"), - Message::Echo => println!("Echo"), + Message::Quit => println!("Quit"), + Message::Echo => println!("Echo"), Message::Move => println!("Move"), Message::ChangeColor => println!("ChangeColor") } diff --git a/exercises/enums/enums3.cairo b/exercises/enums/enums3.cairo index 93a66595d..78493fcf1 100644 --- a/exercises/enums/enums3.cairo +++ b/exercises/enums/enums3.cairo @@ -2,7 +2,7 @@ // Address all the TODOs to make the tests pass! // Execute `starklings hint enums3` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE print +// I AM NOT DONE use debug::PrintTrait; diff --git a/exercises/functions/functions3.cairo b/exercises/functions/functions3.cairo index 27e152440..df0407dd4 100644 --- a/exercises/functions/functions3.cairo +++ b/exercises/functions/functions3.cairo @@ -3,12 +3,10 @@ // I AM NOT DONE - fn main() { call_me(); } fn call_me(num: u64) { - println!("num is {}", num); } diff --git a/exercises/functions/functions4.cairo b/exercises/functions/functions4.cairo index d69217a09..07df25646 100644 --- a/exercises/functions/functions4.cairo +++ b/exercises/functions/functions4.cairo @@ -9,7 +9,6 @@ // I AM NOT DONE - fn main() { let original_price = 51; println!("sale_price is {}", sale_price(original_price)); diff --git a/exercises/if/if1.cairo b/exercises/if/if1.cairo index 89329f05f..981f4a0a9 100644 --- a/exercises/if/if1.cairo +++ b/exercises/if/if1.cairo @@ -24,4 +24,3 @@ mod tests { assert(42 == bigger(32, 42), '42 bigger than 32'); } } - \ No newline at end of file diff --git a/exercises/if/if2.cairo b/exercises/if/if2.cairo index ab48caad2..151a493c3 100644 --- a/exercises/if/if2.cairo +++ b/exercises/if/if2.cairo @@ -38,4 +38,4 @@ mod tests { fn default_to_baz() { assert(foo_if_fizz('literally anything') == 'baz', 'anything else returns baz'); } -} +} diff --git a/exercises/intro/intro2.cairo b/exercises/intro/intro2.cairo index 799b5ddc3..29604faa8 100644 --- a/exercises/intro/intro2.cairo +++ b/exercises/intro/intro2.cairo @@ -2,4 +2,3 @@ // This exercise won't compile... Can you make it compile? -fn main(){} \ No newline at end of file diff --git a/exercises/loops/loops2.cairo b/exercises/loops/loops2.cairo index 2f6fbceab..5a4ba9435 100644 --- a/exercises/loops/loops2.cairo +++ b/exercises/loops/loops2.cairo @@ -16,4 +16,4 @@ fn test_loop() { }; assert(result == 5, 'result should be 5'); -} +} diff --git a/exercises/modules/modules1.cairo b/exercises/modules/modules1.cairo index 0772435f1..9cc95052d 100644 --- a/exercises/modules/modules1.cairo +++ b/exercises/modules/modules1.cairo @@ -28,4 +28,3 @@ mod tests { assert(order_result == 'order_taken', 'Order not taken'); } } - \ No newline at end of file diff --git a/exercises/primitive_types/primitive_types1.cairo b/exercises/primitive_types/primitive_types1.cairo index a57525063..248529e2e 100644 --- a/exercises/primitive_types/primitive_types1.cairo +++ b/exercises/primitive_types/primitive_types1.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE - - fn main() { // Booleans (`bool`) diff --git a/exercises/primitive_types/primitive_types2.cairo b/exercises/primitive_types/primitive_types2.cairo index bc50468d7..6e91cadbf 100644 --- a/exercises/primitive_types/primitive_types2.cairo +++ b/exercises/primitive_types/primitive_types2.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE - - fn main() { // A short string is a string whose length is at most 31 characters, and therefore can fit into a single field element. // Short strings are actually felts, they are not a real string. diff --git a/exercises/primitive_types/primitive_types3.cairo b/exercises/primitive_types/primitive_types3.cairo index 72e7312ae..1855afe97 100644 --- a/exercises/primitive_types/primitive_types3.cairo +++ b/exercises/primitive_types/primitive_types3.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE - - fn main() { let cat = ('Furry McFurson', 3); let // your pattern here = cat; diff --git a/exercises/quizs/quizs1.cairo b/exercises/quizs/quizs1.cairo index 812d40377..1f26c3060 100644 --- a/exercises/quizs/quizs1.cairo +++ b/exercises/quizs/quizs1.cairo @@ -24,4 +24,3 @@ fn verify_test() { assert(82 == price3, 'Incorrect price'); assert(130 == price4, 'Incorrect price'); } - \ No newline at end of file diff --git a/exercises/starknet/basics/starknet4.cairo b/exercises/starknet/basics/starknet4.cairo index b59655992..35edd69b9 100644 --- a/exercises/starknet/basics/starknet4.cairo +++ b/exercises/starknet/basics/starknet4.cairo @@ -163,4 +163,3 @@ mod test { contract0 } } - \ No newline at end of file diff --git a/exercises/structs/structs3.cairo b/exercises/structs/structs3.cairo index 0642f109a..21d04b513 100644 --- a/exercises/structs/structs3.cairo +++ b/exercises/structs/structs3.cairo @@ -79,4 +79,4 @@ fn calculate_transport_fees() { assert(package.get_fees(cents_per_gram) == 4500, 'Wrong fees'); } - + diff --git a/exercises/traits/traits3.cairo b/exercises/traits/traits3.cairo index 648323aa4..6acf198d7 100644 --- a/exercises/traits/traits3.cairo +++ b/exercises/traits/traits3.cairo @@ -76,4 +76,3 @@ fn test_traits3() { assert(dog.make_noise() == 'woof', 'Wrong noise'); assert(dog.get_distance() == 1, 'Wrong distance'); } - diff --git a/exercises/variables/variables1.cairo b/exercises/variables/variables1.cairo index 47651ba59..fd8d596a2 100644 --- a/exercises/variables/variables1.cairo +++ b/exercises/variables/variables1.cairo @@ -2,7 +2,7 @@ // Make me compile! // Execute `starklings hint variables1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE +// I AM NOT DONE use debug::PrintTrait; From 4d69ad446500fb794fcafc19ce21474736729cee Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Sat, 16 Mar 2024 12:26:10 +0530 Subject: [PATCH 3/4] Update primitive_types2.cairo --- exercises/primitive_types/primitive_types2.cairo | 6 ------ 1 file changed, 6 deletions(-) diff --git a/exercises/primitive_types/primitive_types2.cairo b/exercises/primitive_types/primitive_types2.cairo index 6e91cadbf..dfa1da560 100644 --- a/exercises/primitive_types/primitive_types2.cairo +++ b/exercises/primitive_types/primitive_types2.cairo @@ -13,15 +13,12 @@ fn main() { if is_alphabetic( ref my_first_initial ) { - println!(" Alphabetical !"); } else if is_numeric( ref my_first_initial ) { - println!(" Numerical !"); } else { - println!(" Neither alphabetic nor numeric!"); } @@ -30,15 +27,12 @@ fn main() { if is_alphabetic( ref your_character ) { - println!(" Alphabetical !"); } else if is_numeric( ref your_character ) { - println!(" Numerical!"); } else { - println!(" Neither alphabetic nor numeric!"); } } From 6bb0f9c0e98caeffe2c50adc5f69f7c5885c2d36 Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Sat, 16 Mar 2024 12:28:31 +0530 Subject: [PATCH 4/4] Cleanup suggestions from code review --- exercises/modules/modules2.cairo | 1 - exercises/operations/operations1.cairo | 1 - exercises/options/options2.cairo | 1 - exercises/options/options3.cairo | 3 --- exercises/primitive_types/primitive_types1.cairo | 2 -- exercises/variables/variables1.cairo | 1 - 6 files changed, 9 deletions(-) diff --git a/exercises/modules/modules2.cairo b/exercises/modules/modules2.cairo index fe127408f..259d83836 100644 --- a/exercises/modules/modules2.cairo +++ b/exercises/modules/modules2.cairo @@ -2,7 +2,6 @@ // These modules have some issues, can you fix? // Run `starklings hint modules2` or `hint` watch command for a hint. -// use debug::PrintTrait; const YEAR: u16 = 2050; mod order { diff --git a/exercises/operations/operations1.cairo b/exercises/operations/operations1.cairo index e82d20673..6bddc2535 100644 --- a/exercises/operations/operations1.cairo +++ b/exercises/operations/operations1.cairo @@ -6,7 +6,6 @@ // TODO // Return the solution of x^3 + y - 2 - fn poly(x: usize, y: usize) -> usize { // FILL ME res // Do not change diff --git a/exercises/options/options2.cairo b/exercises/options/options2.cairo index 354b53d52..2e703de1b 100644 --- a/exercises/options/options2.cairo +++ b/exercises/options/options2.cairo @@ -5,7 +5,6 @@ use option::OptionTrait; - #[test] fn test_options() { let target = 'starklings'; diff --git a/exercises/options/options3.cairo b/exercises/options/options3.cairo index 9b93c4766..024d69365 100644 --- a/exercises/options/options3.cairo +++ b/exercises/options/options3.cairo @@ -40,11 +40,8 @@ fn display_grades(student: @Student, index: usize) { // TODO: Modify the following lines so that if there is a grade for the course, it is printed. // Otherwise, print "No grade". // - println!("grade is {}", course.unwrap()); display_grades(student, index + 1); - - } diff --git a/exercises/primitive_types/primitive_types1.cairo b/exercises/primitive_types/primitive_types1.cairo index 248529e2e..cb14c5866 100644 --- a/exercises/primitive_types/primitive_types1.cairo +++ b/exercises/primitive_types/primitive_types1.cairo @@ -9,13 +9,11 @@ fn main() { let is_morning = true; if is_morning { - println!("Good morning!"); } let // Finish the rest of this line like the example! Or make it be false! if is_evening { - println!("Good evening!"); } } diff --git a/exercises/variables/variables1.cairo b/exercises/variables/variables1.cairo index fd8d596a2..de0169fce 100644 --- a/exercises/variables/variables1.cairo +++ b/exercises/variables/variables1.cairo @@ -8,6 +8,5 @@ use debug::PrintTrait; fn main() { x = 5 ; - // x.print(); println!(" x is {}", x) }