This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
txtInput = str(input("please enter a palindrome: ")) | |
reversedInput = txtInput[::-1] | |
if reversedInput == txtInput: | |
print("good job") | |
else: | |
print("you missed it") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ipAddress = input("please enter an ipAddress: ") | |
ipAddress = "192.168.7.7" | |
# check if number of dots is 3 | |
numberOfDot = 0 | |
for char in ipAddress: | |
if char == '.': | |
numberOfDot += 1 | |
totNumbOfDot = numberOfDot # output of this section is totNumberOfDot, to be checked at the end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# and write a program that returns a list that contains only the elements that are common between the | |
# lists (without duplicates). Make sure your program works on two lists of different sizes. | |
# exercise from http://www.practicepython.org/exercise/2014/03/05/05-list-overlap.html | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
c = [] | |
# Create list c | |
for num in a: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Main | |
void main() { | |
final personOne = Person(name: "Mario", age: 23, height: 1.83); | |
print(personOne.describePerson()); | |
final employeeOne = Employee( | |
name: "Mario", | |
age: 23, | |
height: 1.83, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServerException implements Exception {} | |
class DataParsingException implements Exception {} | |
class NoConnectionException implements Exception {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'failures.freezed.dart'; | |
@freezed | |
class FailureEntity with _$FailureEntity { | |
const FailureEntity._(); // This constructor is needed to have custom methods in Freezed. | |
const factory FailureEntity.serverFailure() = ServerFailure; | |
const factory FailureEntity.dataParsingFailure() = DataParsingFailure; | |
const factory FailureEntity.noConnectionFailure() = NoConnectionFailure; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:equatable/equatable.dart'; | |
import 'failures.dart'; | |
class ErrorObject extends Equatable { | |
const ErrorObject({ | |
required this.title, | |
required this.message, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/data/models/post_model.dart'; | |
import 'package:http/http.dart' as http; | |
class JsonPlaceholderV1 { | |
JsonPlaceholderV1({ | |
required this.httpClient, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:dartz/dartz.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/data/datasources/json_placeholder_v1.dart'; | |
import 'package:functional_error_handling/features/post/domain/entities/post_entity.dart'; | |
import 'package:functional_error_handling/features/post/domain/repositories/posts_repository.dart'; | |
class PostsRepositoryImpl implements PostsRepository { | |
@override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:bloc/bloc.dart'; | |
import 'package:dartz/dartz.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/domain/entities/post_entity.dart'; | |
import 'package:functional_error_handling/features/post/domain/repositories/posts_repository.dart'; | |
part 'posts_list.freezed.dart'; |
OlderNewer